Node Samples for Associated Column and/or Optionset Value #162
-
In the Create Request and Update Request examples there are relatively simple values given and it's great and easy to get started. What if we need to insert or update an associated column in the sample request? Is the best practice to perform the CreateRequest or UpdateRequest operation before doing an AssociateRequest? As an example, suppose I have an associated column for "modifiedonbehalfof" which is associated with the user's entity. How could I modify the CreateRequest or UpdateRequest body to accomodate setting the associated key value (such as a GUID) within the CreateRequest operation itself? Addtionally for OptionSets: Am I safe to assume I can simply set the value for the field to the OptionSet value e.g. 1000000 and everything will map properly in D365 for that request? Please forgive me if this is the incorrect forum for such a question. If that is the case, could you kindly direct me to the proper resource? Great library btw it has saved me a ton of effort and is greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @ssederburg , sorry for a long delay in my response, I was away for a couple of weeks and have just returned back. So, I hope it's not too late. I would highly recommend getting familiar with an official Dataverse Web API documentation. You will find most of the information in there as it has been improved significantly over the years. DynamicsWebApi in itself is just a helper library, so most of the examples in that documentation will also be useful when using the library. Now, to answer your questions:
For example: await dynamicsWebApi.create({
collection: `accounts`,
data: {
name: "my test",
"modifiedonbehalfof@odata.bind": "systemusers(ac3dd1b1-b6e5-425e-b30b-fb9c060b8b8a)"
}
}); Now, in this case, I don't know if this is going to work, because this is a system field and it maybe rewritten by the system itself. If you want to impersonate a user, you can use Hope this helps! |
Beta Was this translation helpful? Give feedback.
Hi @ssederburg , sorry for a long delay in my response, I was away for a couple of weeks and have just returned back. So, I hope it's not too late.
I would highly recommend getting familiar with an official Dataverse Web API documentation. You will find most of the information in there as it has been improved significantly over the years. DynamicsWebApi in itself is just a helper library, so most of the examples in that documentation will also be useful when using the library.
Now, to answer your questions: