In lwc when we use the navigation mixin to navigate to a default record modal we can use defaultFieldsValues to open the modal with some fields filled in, how can we do the same thing in the Navigate Action of a flexcard in vlocity/omnistudio?
1 Answer
This is a frustrating limitation of flexcards! Especially since this seems to be built upon the NavigationMixin, but just doesn't provide the options in the builder to pass in these parameters.
A possible workaround is to perform the same thing using a URL Hack. Please note the name hack - it's not officially documented / endorsed functionality.
Use this solution at your own risk
Setup a Navigation Action with:
- Target = "Web Page"
- URL =
/lightning/o/{ObjectName}/new?defaultFieldValues={FieldName1}={Value},{FieldName2}={Value}
Substitute {ObjectName}
with the Object API name
After defaultFieldValues
you can provide a comma-separated list of field/value pairs.
For example, to create a new Account with default values for Rating = Hot and Type = Other:
/lightning/o/Account/new?defaultFieldValues=Rating=Hot,Type=Other
To make this more dynamic, you could also use Flexcard Merge Syntax in the URL:
/lightning/o/Account/new?defaultFieldValues=Rating={Rating},Type={Type}
This is a useful intro to URL Hacking - which I recommend using sparingly where more offical 'navigation' methods are possible: https://www.salesforceben.com/salesforce-url-hacking-for-lightning-tutorial/