To set a lookup field value, you need 3 parameters.
- Id of the lookup record
- name of the lookup record
- entity name of the lookup entity
Here is how to use these values to set an account lookup field.
var lookupValue = new Array();
lookupValue = new Object();
lookupValue.id = myAccountId;
lookupValue.name = myAccountName;
lookupValue.entityType = "account";
Can I use this to create a “None” value?
Hi, didn’t get the question sorry
My apologies. We have a lookup field of users, and there is a requirement to include a None option. Can I use this script to achieve the requirement?
Hi, I’m afraid you can’t do that. You can’t put a placeholder to the lookup field. But as a workaround you can create your own pcf contro. You can make it look like lookup. Then you can add a none placeholder. Check the pcf controls
Good to know. Many thanks 🙂