I have inserted a dropdownbox in my PowerApp
After I have done that my other code has stopped working
If I remove the dropdown box the code is working.
The PowerApp is collecting messages from Admin center. When clicking on a message your will be transformed to another screen where you can commment on the message or send the message to Planner. Behind is a sharepointlist called MessageCenterOrg.
What is wrong with my code.
Can someone please help ?
Solved! Go to Solution.
Let's make a couple of alterations to reduce the amount of formula actions.
First one:
If(!IsBlank(SelectedBucket),
Set(TaskAdded,Planner.CreateTask(SelectedPlan.id,TaskText.Text,{bucketId:SelectedBucket.id,dueDateTime:DueDatePicker.SelectedDate,assignments:AssignToUser.Id})),
Set(TaskAdded,Planner.CreateTask(SelectedPlan.id,TaskText.Text,{dueDateTime:DueDatePicker.SelectedDate,assignments:AssignToUser.Id}))
);
Set(ShowSuccess, true);
Set(varRecord,
With({_add: "***" & CountRows(NoteGallery.AllItems) + 1 & " - " & User().FullName & " - " & Text( Now(),DateTimeFormat.LongDateTime24,"nb-NO" ) &
":<br>Opprettet oppgave i Planner '"& SelectedPlan.title &"' i samling '" & SelectedBucket.name & "'<br>"},
Patch(
MessageCenterOrg,
LookUp(MessageCenterOrg, ID=varRecord.ID),
{Notes: varRecord.Notes & _add,
Planner: varRecord.Planner & _add
}
)
)
)
Second one:
Set(varRecord,
Patch(
MessageCenterOrg,
LookUp(MessageCenterOrg, ID=varRecord.ID),
{Notes: varRecord.Notes & "***" & CountRows(NoteGallery.AllItems) + 1 & " - " & User().FullName & " - " & Text( Now(),DateTimeFormat.LongDateTime24,"nb-NO" )&
":<br>" & RichTextEditor.HtmlText
}
)
);
Reset(RichTextEditor)
Also, at this point the varRecord setting seems consistent. I assume that the Gallery you are coming from is based on the MessageCenterOrg datasource and that your Gallery is not adding or altering the columns of the datasource.
If that is true, then one quick thing to try - save and close your app and then go back into it. Sometimes, when working with full record based variables, the formula editor gets confused on the schema and an exit and back in usually solves that.
@RandyHayes Amazing, works lika a charm. Thank You so much. I have much to lear to simplify code. You are assuming right according to the gallery..
Here is a screenshot after adding some text and Planner. As you can see, when text is adding a notebokk is vsible and when adding A Planner a Planner icon become visible. This way my team will hav controll over messagecenter.
Very good!
If you found one of my responses helpful for resolving the problem, could you please mark that as a solution also so that others that may have similar issues can locate solutions quickly? Thanks and glad it is all where you need it now.
Your issue is with varRecord. How were you setting that before?
Thank you for answering @RandyHayes The varRecord was set as seen in the code. How should I alter it ?
It's hard to tell from the images. The Formulas in them are not clear (resolution is a bit small). At a glance of them for what I could see, the formula appears generally correct. The formula you have in the OnSelect of the Lagre button should only be doing one patch and not two, but it still doesn't appear incorrect.
You have shown the formulas and the red underlines, but can you please hover over the red underlines and see what the formula editor tells you the error is? Especially over any darker/thicker red underline.
If(!IsBlank(SelectedBucket),
Set(TaskAdded,Planner.CreateTask(SelectedPlan.id,TaskText.Text,{bucketId:SelectedBucket.id,dueDateTime:DueDatePicker.SelectedDate,assignments:AssignToUser.Id})),
Set(TaskAdded,Planner.CreateTask(SelectedPlan.id,TaskText.Text,{dueDateTime:DueDatePicker.SelectedDate,assignments:AssignToUser.Id}))
);
Set(ShowSuccess, true);
Set(varRecord,
Patch(
MessageCenterOrg,
varRecord,
{Notes:varRecord.Notes & "***" & CountRows(NoteGallery.AllItems) + 1 & " - " & User().FullName & " - " &Text( Now(),DateTimeFormat.LongDateTime24,"nb-NO" )&
":<br>" & "Opprettet oppgave i Planner " &"'"& SelectedPlan.title &"' "& "i samling " & "'"& SelectedBucket.name&"'"&
"<br>"}
)
);
Set(varRecord,
Patch(
MessageCenterOrg,
varRecord,
{Planner:varRecord.Planner & "***" & CountRows(NoteGallery.AllItems) + 1 & " - " & User().FullName & " - " &Text( Now(),DateTimeFormat.LongDateTime24,"nb-NO" )&
":<br>" & "Opprettet oppgave i Planner " &"'"& SelectedPlan.title &"' "& "i samling " & "'"& SelectedBucket.name&"'"&
"<br>"}
)
)
Set(varRecord,
Patch(
MessageCenterOrg,
varRecord,
{Notes:varRecord.Notes & "***" & CountRows(NoteGallery.AllItems) + 1 & " - " & User().FullName & " - " &Text( Now(),DateTimeFormat.LongDateTime24,"nb-NO" )&
":<br>" & RichTextEditor.HtmlText}
)
);
Reset(RichTextEditor)
varRecord shows invalid argument type (Error),Expecting a record value instead- Else The function patch has some invalid arguments.
Filter(Split(varRecord.Notes,"***"),!IsBlank(Result))
Notes shows Invalid use of '.' else The function split has some invalid arguments
Set(varRecord,ThisItem)
can not be evaluated
@RandyHayes In the other screen the navigate is Set(varRecord , ThisItem);Navigate(MesageCenter)
Let's make a couple of alterations to reduce the amount of formula actions.
First one:
If(!IsBlank(SelectedBucket),
Set(TaskAdded,Planner.CreateTask(SelectedPlan.id,TaskText.Text,{bucketId:SelectedBucket.id,dueDateTime:DueDatePicker.SelectedDate,assignments:AssignToUser.Id})),
Set(TaskAdded,Planner.CreateTask(SelectedPlan.id,TaskText.Text,{dueDateTime:DueDatePicker.SelectedDate,assignments:AssignToUser.Id}))
);
Set(ShowSuccess, true);
Set(varRecord,
With({_add: "***" & CountRows(NoteGallery.AllItems) + 1 & " - " & User().FullName & " - " & Text( Now(),DateTimeFormat.LongDateTime24,"nb-NO" ) &
":<br>Opprettet oppgave i Planner '"& SelectedPlan.title &"' i samling '" & SelectedBucket.name & "'<br>"},
Patch(
MessageCenterOrg,
LookUp(MessageCenterOrg, ID=varRecord.ID),
{Notes: varRecord.Notes & _add,
Planner: varRecord.Planner & _add
}
)
)
)
Second one:
Set(varRecord,
Patch(
MessageCenterOrg,
LookUp(MessageCenterOrg, ID=varRecord.ID),
{Notes: varRecord.Notes & "***" & CountRows(NoteGallery.AllItems) + 1 & " - " & User().FullName & " - " & Text( Now(),DateTimeFormat.LongDateTime24,"nb-NO" )&
":<br>" & RichTextEditor.HtmlText
}
)
);
Reset(RichTextEditor)
Also, at this point the varRecord setting seems consistent. I assume that the Gallery you are coming from is based on the MessageCenterOrg datasource and that your Gallery is not adding or altering the columns of the datasource.
If that is true, then one quick thing to try - save and close your app and then go back into it. Sometimes, when working with full record based variables, the formula editor gets confused on the schema and an exit and back in usually solves that.
@RandyHayes Amazing, works lika a charm. Thank You so much. I have much to lear to simplify code. You are assuming right according to the gallery..
Here is a screenshot after adding some text and Planner. As you can see, when text is adding a notebokk is vsible and when adding A Planner a Planner icon become visible. This way my team will hav controll over messagecenter.
Very good!
If you found one of my responses helpful for resolving the problem, could you please mark that as a solution also so that others that may have similar issues can locate solutions quickly? Thanks and glad it is all where you need it now.
User | Count |
---|---|
121 | |
88 | |
88 | |
75 | |
66 |
User | Count |
---|---|
217 | |
180 | |
138 | |
96 | |
73 |