How to  create a plugin to update D365 lookups for Country and State

apollo7 used Ask the Experts™
Dynamics 365 9.1, InsideView

I am trying to create a plugin to update D365 lookups for Country and State.   The source of the updates will be option-set values from Insideview.

I have the basic structure (using statements, IPlugin interface, plugin code) but looking for guidance or examples for updating the lookup guids from the option set values.

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chief Technology Ninja
Distinguished Expert 2018
Hi apollo7,

You will search the entities which are storing Country and State using QueryByAttribute OR FetchXML and first retrieve the right GUIDs for both Country and State and once that is done, you will simply

entity["COUNTRY LOOKUPFIELDNAME"] = new EntityReference("COUNTRY ENTITY", new Guid("COUNTRY GUID"));
entity["STATE LOOKUPFIELDNAME"] = new EntityReference("STATE ENTITY", new Guid("STATE GUID"));

Open in new window



Thanks for your help

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial