cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sakleboe
Level: Powered On

Howto to realize a comments history function? --> Challenges with variables

Hello,

In my scenario, I want to realize a comments history function in a PowerApp form that is based on a SharePoint list.

So far, I have the fields SP_Comment and SP_CommentsHistory.

When user saves the form, the comment from SP_Comment shall be stored in SP_CommentsHistory with some further details.

You can see the current status in below picture:

2019-01-01 18_11_28-Window.png

The implemented PowerApp logic stores the information as I want it, if I only work on one item.

Let's say, that above item has the ID 1.

If I now open another item with ID 2 (without doing a page refresh before) the field SP_CommentsHistory shows the information from the item with the ID 1.

What do I have to do to make the screen working as a user would expect it?

 

Below you can insight my current configuration:

2019-01-01 19_27_06-Window.png2019-01-01 19_27_24-Window.png

DataCardValue18 ist part of SP_CommentsHistory Card


2019-01-01 19_27_56-Window.png

DataCardValue17 ist part of SP_Comment Card

 

Thanks in advance for your support!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Howto to realize a comments history function? --> Challenges with variables

Hi @sakleboe,

Could you please share a bit more about the SP_CommentsHistory column in your SP list? Is it a Multiple line of text type column?

Based on the formula that you provided, I think there is something wrong with it. I have made a test on my side, and don't have the issue that you mentioned, please take a try with the following workaround:

4.JPG5.JPG6.JPG7.JPG

Set the OnEdit property of the SharePointIntegration control to following:

Refresh('20190102_case3'); /* Add formula here */
Set(varComment, "");
Set(varCommentsHistory, ""); /* Add formula here */ Set(varCommentsHistory, SharePointIntegration.Selected.SP_CommentsHistory); /* <--Modify your formula here */ EditForm(SharePointForm1)

On your side, you should type:

Refresh('YourSPList');  /* <-- Add formula here */
Set(varComment, "");
Set(varCommentsHistory, ""); /* <--Add formula here */ Set(varCommentsHistory, SharePointIntegration.Selected.SP_CommentsHistory); /* <--Modify your formula here */ EditForm(SharePointForm1)

Set the OnSave property of the SharePointIntegration control to following:

If(
    Not(IsBlank(DataCardValue6.Text)),
    Set(varCommentsHistory, User().FullName & "("&Now()&"): "&DataCardValue6.Text&Char(10)&varCommentsHistory),
    Set(varCommentsHistory, "")
);
SubmitForm(SharePointForm1)

On your side, it is:

If(
    Not(IsBlank(DataCardValue17.Text)),
    Set(varCommentsHistory, User().FullName & "("&Now()&"): "& DataCardValue17.Text&Char(10)& varCommentsHistory),
    Set(varCommentsHistory, "")
);
SubmitForm(SharePointForm1)

Set the OnView property of the SharePointIntegration control to following:

Refresh('YourSPList');
Set(varCommentsHistory, SharePointIntegration.Selected.SP_CommentsHistory); ViewForm(SharePointForm1)

Set the Default proeprty of the SP_CommentsHistory Data Card to following:

varCommentsHistory

Set the Default property of the SP_Comment Data Card to following:

varComment

Note: The SP_CommentsHistory  column is a Multiple lines of text type column, which enables "Append changes to existing text" option. The SP_Comment column is also a Multiple lines of text type column.

 

Please check the attached GIF screenshot for more details:

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Community Support Team
Community Support Team

Re: Howto to realize a comments history function? --> Challenges with variables

Hi @sakleboe,

Could you please share a bit more about the SP_CommentsHistory column in your SP list? Is it a Multiple line of text type column?

Based on the formula that you provided, I think there is something wrong with it. I have made a test on my side, and don't have the issue that you mentioned, please take a try with the following workaround:

4.JPG5.JPG6.JPG7.JPG

Set the OnEdit property of the SharePointIntegration control to following:

Refresh('20190102_case3'); /* Add formula here */
Set(varComment, "");
Set(varCommentsHistory, ""); /* Add formula here */ Set(varCommentsHistory, SharePointIntegration.Selected.SP_CommentsHistory); /* <--Modify your formula here */ EditForm(SharePointForm1)

On your side, you should type:

Refresh('YourSPList');  /* <-- Add formula here */
Set(varComment, "");
Set(varCommentsHistory, ""); /* <--Add formula here */ Set(varCommentsHistory, SharePointIntegration.Selected.SP_CommentsHistory); /* <--Modify your formula here */ EditForm(SharePointForm1)

Set the OnSave property of the SharePointIntegration control to following:

If(
    Not(IsBlank(DataCardValue6.Text)),
    Set(varCommentsHistory, User().FullName & "("&Now()&"): "&DataCardValue6.Text&Char(10)&varCommentsHistory),
    Set(varCommentsHistory, "")
);
SubmitForm(SharePointForm1)

On your side, it is:

If(
    Not(IsBlank(DataCardValue17.Text)),
    Set(varCommentsHistory, User().FullName & "("&Now()&"): "& DataCardValue17.Text&Char(10)& varCommentsHistory),
    Set(varCommentsHistory, "")
);
SubmitForm(SharePointForm1)

Set the OnView property of the SharePointIntegration control to following:

Refresh('YourSPList');
Set(varCommentsHistory, SharePointIntegration.Selected.SP_CommentsHistory); ViewForm(SharePointForm1)

Set the Default proeprty of the SP_CommentsHistory Data Card to following:

varCommentsHistory

Set the Default property of the SP_Comment Data Card to following:

varComment

Note: The SP_CommentsHistory  column is a Multiple lines of text type column, which enables "Append changes to existing text" option. The SP_Comment column is also a Multiple lines of text type column.

 

Please check the attached GIF screenshot for more details:

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
sakleboe
Level: Powered On

Re: Howto to realize a comments history function? --> Challenges with variables

Hi Kris,

Thanks a lot for your support.

Like in your scenario the column SP_CommentsHistory is a multipleline column.

Based on your post I could identify that I made two mistakes:

  1. In SharePointIntegration --> OnEdit my declaration was wrong.
    I changed
    Set(varCommentsHistory, DataCardValue18.Text);
    to
    Set(varCommentsHistory, SharePointIntegration.Selected.SP_CommentsHistory);
  2. I did not implemented a refresh in SharePointIntegration --> OnView/OnEdit.
    Refresh(SupportTickets);
    Due to the Refresh I do not see the comments history from former clicked list item anymore.

 

Best regards,

 

Sascha

 

 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 54 members 4,460 guests
Please welcome our newest community members: