Object Field dependencies through API
AnsweredHi,
I was trying to create Dependencies between two picklists in one of the objects, But It is not working for me. Please help me how I can progress on below scenario.
For Example : I have 2 Picklists A and B.and values a1,a2, a3 and b1,b2,b3 respectively in Object XYZ.
When I select a1 from Picklist A, b1,b2 should be populated in Picklist B.
When I select a2 from Picklist B, b1,b3 should be populed in Picklist B.
MDL script that I am trying is :
ALTER Object XYZ (
MODIFY Field B (
controlling_picklist('A'),
a1 ('b1,b2')
)
);
Thanks in advance.
-
Official comment
When working with Vault components using MDL, you will need to refer to the components using the component record name (xyz__c), and not the label (XYZ). For Example, to ALTER the XYZ object, you will need to use
ALTER Object xyz__c
For figuring out the correct format of MDL scripts, it can be helpful to create an example in the Vault UI, and then retrieve the MDL script using the API. In your use case, you can create or use an object, add 2 picklists to it, then create the picklist dependencies in the UI. Then retrieve the MDL script for this configuration using the "Retrieve Component Record (MDL)" endpoint.
https://developer.veevavault.com/api/22.3/#retrieve-component-record-mdl
Below is a piece of sample code for creating dependencies between picklists using MDL.ALTER Object test_object__c (
MODIFY Field picklist_b__c(
controlling_picklist('picklist_a__c'),
picklist_dependencies('{"value_a1__c":["value_b1__c","value_b2__c"],"value_a2__c":["value_b1__c","value_b3__c"],"value_a3__c":[]}')
)
); -
Thank you. It worked.
0
Please sign in to leave a comment.
Comments
2 comments