Dear All,
I have the following scenarios:
a)
1. The user add an attachment in a powerapps form
2. The status should change to Pending
b)
1. The user delete the attachments
2. The status should change to Draft
How can I put the above situations in a formula?
I have tried this formula, but if the user add an attachment, the status is still on Draft.
Refresh('LABELS - SUPPLIERS RAW MATERIALS');SubmitForm(FormLabel);
If(
CountRows(DataCardValue14.Attachments) <1,
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Draft"}}
)); If(
CountRows(DataCardValue14.Attachments) >0,
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Pending"}}
)
);
Set(
varDialogSaveLabel,
false
);
Navigate('Raw material overview')
Thank you
Claudia
Solved! Go to Solution.
To be honest I kinda missed that you were submitting a form in your original post. Try putting this in the button you are using to submit, and take the other formula out of the OnAddFile and OnRemoveFile actions.
UpdateContext({attachments: If(IsEmpty(ModifyForm.Attachments), "Empty")});
SubmitForm(FormLabel);
If(attachments = "Empty",
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Draft"}}
),
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Pending"}}
))
;
Set(
varDialogSaveLabel,
false
);
You may have to fix the syntax slightly.
Hopefully that does the trick 🤞
Hi,
You are very close! For your if statement, try using If(IsEmpty(DataCardValue14.Attachments) then do your patches appropriately. Then I would put that in them in the OnAddFile and OnRemoveFile actions:
Thank you for your fats reaction!
Please can you explain, what to insert OnAddFile and OnRemoveFile?The If statement?
Thank you
Yes, put the if statement in there. Sorry for the lack of description.
It is not working, but maybe I am doing something wrong:
Refresh('LABELS - SUPPLIERS RAW MATERIALS');SubmitForm(FormLabel);
If(IsEmpty(ModifyForm.Attachments),
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Draft"}}
));
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Pending"}}
)
;
Set(
varDialogSaveLabel,
false
);
Navigate('Raw material overview')
Put the submit after the patching
still not working ☹️
If(IsEmpty(ModifyForm.Attachments),
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Draft"}}
),
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Pending"}}
))
;SubmitForm(FormLabel);
Set(
varDialogSaveLabel,
false
);
Navigate('Raw material overview')
To be honest I kinda missed that you were submitting a form in your original post. Try putting this in the button you are using to submit, and take the other formula out of the OnAddFile and OnRemoveFile actions.
UpdateContext({attachments: If(IsEmpty(ModifyForm.Attachments), "Empty")});
SubmitForm(FormLabel);
If(attachments = "Empty",
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Draft"}}
),
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Pending"}}
))
;
Set(
varDialogSaveLabel,
false
);
You may have to fix the syntax slightly.
Hopefully that does the trick 🤞
Thank you! I've changed the formula as below and it seems that it works:
SubmitForm(FormLabel);
If(
IsEmpty(ModifyForm.Attachments),
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Draft"}}
),
Patch(
'LABELS - SUPPLIERS RAW MATERIALS',
FormLabel.LastSubmit,
{CheckedByIPRA: {Value: "Pending"}}
)
);
Set(
varDialogSaveLabel,
false
);
Navigate(Gallery1)
Excellent!
User | Count |
---|---|
121 | |
88 | |
88 | |
75 | |
66 |
User | Count |
---|---|
215 | |
180 | |
138 | |
96 | |
82 |