I have Parent form with "List or Library" control in it. Parent form has several JS functions.
A Pop-up window opens to edit the "List or Library" control. When the Status field is changed to "Complete" by user in the Pop-up window and submit, i want to trigger a JS function in Parent form.
How can i achieve this? I have seen articles to access Parent form fields but not Parent form variables or functions.
You can trigger function when the item in List or Library control is changed. To check the status of the changed item use the PnP request. See the code sample.
fd.control('SPDataTable1').$on('change', function(changeData) {
if (changeData.type === 'edit') {
console.log(changeData);
pnp.sp.web.lists.getByTitle('ListName').items.getById(changeData.itemId).get().then(function(i){
if(i.Status === 'Complete' )[
//call function
]
})
}
});
@mnikitina Thank you. Will try that.
Was wondering if there is a way to trigger function in parent form with any pointer/reference to parent from child(pop-up).
Thanks,
Muthu
@mnikitina I have a SharePoint Plumsail form with "Reviewer" (Person) field and "List or Library" control linked to "Custom Tasks" list. I like to send notification to Reviewer with some details/fields in parent form when all Tasks are completed (by Assignee of Tasks).
The "List or Library" control is configured to open Pop-up for editing, the Task Assignee will open\edit his Task and mark as Complete. At this stage, i check if all Tasks are complete, then i need to trigger a function in the parent form to send an email with some more field values available in the parent form.
Thanks,
Muthu
I had a similar need. I created a Common field on my parent form, then used dialog returnedArgs to set the Common field. In the parent form I used on change event to initiate the function.
@cwalter2 Thanks for your input.
I dont use Dialog to open the pop-up, instead i use "List or Library" control's in-built pop-up to edit the item.
Will it return returnedArgs? Can you please share a code snippet in the parent form where you read and set the common field.