On a project I was working on recently, we had a custom entity “Quote” that had a set of tasks associated with it. The entity only needed tasks and we didn’t want to associate other activity entities with the Quote. We also wanted those tasks to show on the Activity view for the record’s Account.
In order to accomplish this, we decided we’d create a custom lookup field on the task entity to link it to the Quote and set the task’s Regarding field to the account. I was tasked with creating a custom ribbon button to launch a new task form populating the task lookup and the regarding field.
Unfortunately, I found that the documentation states “You can’t set the values for partylist or regarding lookups”. My first idea was to create a custom form parameters hsl RegardingAccountId and hsl_RegardingAccountName and have an onload script that read the values and populate the regarding object id field if they exist.
However, I decided to explore and see if I could find a cleaner solution. Looking through all the parameters available to openForm, I saw createFromEntity. I tried that and found my answer. Using the code snippet below, I was able to successfully launch the form with the Regarding and Quote fields pre-populated.
Subscribe to our blog and never miss a post
Join our growing community of professionals and get insights, resources, and tips in your inbox weekly.