Solved! Go to Solution.
Hi gsivasai,
Perfect. That worked!!! Thanks so very much. Let me try adding other fields.
Kind regards,
Nick
Hi gsivasai,
Thanks for the response.
The field types are correct as below -
1. Logged in User - Single Line Text
2. Current Users Email - Single Line Text field
3. Status - Choice field.
Basically, #1 and #2 field are one time only as user submit the initial intake form.
#3 Status field I would like to set initially to Submitted. Which after submission, the admin users will have ability to change the status by selecting the choices from dropdown.
Please let me know if I could explain better. I look forward to the pointers to achieve this.
Kind regards,
nick
Hi @Nick2020,
Here's how you could update those fields using the Patch() function:
Set(currentUser, User())
If(<condtion logic>,Patch(SourceList,{ID:<ItemId>}, { SubmittedBy: currentUser.FullName, SubmitterEmail: currentUser.Email, Date: Today(), Status: { '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Id: 2, Value: "Submitted" } })); SubmitForm(MyForm)Also, replace the field names (Status, SubmitterEmail, Date etc) to match teh field displaynames in your list.
Hi Gsivasai,
Thanks for the response.
I tried the just updating one field first.
For the new form condition, I am not getting the RequestDate updated.
It seems it is not getting the correct ID or ID is coming blank.
Please let me know how to check if this is the new form. I want to set these values only when a user submits the form first time. (Except Status field, they should not be able to change it in future Edit screens).
Following is what I tried to update RequestDate
If(SharePointForm1.Mode = New, Patch(List_Request,{ID:SharePointForm1.LastSubmit.ID}, { RequestDate:Today() })); SubmitForm(SharePointForm1)
The ID is blank is because the item hasn't been created in the first place. How about we try this?-
If( SharePointForm1.Mode = New, Patch( List_Request, {ID: Blank()}, SharePointForm1.Updates, { RequestDate: Today()} ), SubmitForm(SharePointForm1) )
The above is patching a new item with all the updates to the form along with current date for the RequestDate field if the form mode is "New". Else, the entire form is submitted without custom values.
ID:Blank() is a way to tell SP that it's patching a brand new item.
Hi gsivasai,
Perfect. That worked!!! Thanks so very much. Let me try adding other fields.
Kind regards,
Nick
Thanks gsivasai. I appreciate all help. The solution was perfect.
Regards,
nick
Thanks @gsivasai !
User | Count |
---|---|
142 | |
137 | |
78 | |
73 | |
70 |
User | Count |
---|---|
228 | |
139 | |
79 | |
61 | |
57 |