I have this code to open a form to create a new contact,
Microsoft.CIFramework.openForm(JSON.stringify(ef), JSON.stringify(fp)).then(function (resultStr) { let result = JSON.parse(resultStr); console.log(result);
//Once the form is opened and saved, CIF will return the newly created recordId. Save it for later use result[/savedEntityReference/].forEach(function (elem) { // do something here }); });
Based on this sample, CIF will returned savedEntityReference object but at this point the form is not saved yet so there is nothing useful returns in this object as you can see here:
My question is, how do I retrieved back the created id once user clicked save button in the form? I am new to this and quite embarassingly not very good in javascript. Any pointers is appreciated.
However, when I choose to open a Quick Create Form using the useQuickCreateForm property, a savedEntityReference with the entity ID is returned only when the form is saved.
This property is also available in the entityFormOptions of the Microsoft.CIFramework.openForm api.
Therefore, you can try using the property to see if savedEntityReference is able to return an entity ID.
Best Regards, Dengliang Li
Was this reply helpful?YesNo
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.