Skip to main content
Insert Banner Message here.

Community

Search

Welcome to Community

Veeva JDK trigger to set default field value of picklist type?

Answered

Comments

5 comments

  • John Choo

    Hi James,

    It is possible to get / set the value of a picklist field. In the example below, I have a frequency__c custom field that has values of "Daily", "Weekly", "Monthly" and "Annually", and I have a trigger that executes when the field value is changed to get the changed value.  

           List<String> freqNew = recNew.getValue("frequency__c", ValueType.PICKLIST_VALUES);

    To set the value you will need to do the following:

           List<String> newFreqValue = VaultCollections.newList();
           newFreqValue.add("weekly__c"); // the name of the picklist value
           recNew.setValue("frequency__c", newFreqValue);

    You may find that some system fields are not readable and/or writable, and hence you will get the error you are seeing.

    Hope this helps

    Regards,

    John

    0
  • James Huang

    Hi, John

    I tried and it works. Thank you very much.

    I have a simple question that I check the Veeva JDK API documentation, this interface is not mentioned in the document. If you didn't tell me, I will never find out. is the Java JDK documentation update in the next release?

     

    Please advise.

     

    James

    0
  • John Choo

    Hi James,

    The documentation is fine, it's just that you need examples to understand how variable declarations work as well as other Java SDK features.

    Check out these resources if you have not:

    https://developer.veevavault.com/sdk/#vault-java-sdk-overview

    https://developer.veevavault.com/sdk/#sample-code

     

    Regards,

    John

     

     

    0
  • James Huang

    Hi, John,

    It is James again. I hope you are all right at this Corona Erra,

    I have a quick and silly questions. When I install the Vault sample JDK program, does it automatically install the all Vault SDK API on my local machine? I could not find then.

     

    Best

     

    James

    0
  • John Choo

    Hi James,

    I am well thanks, hope you are too.

    No, the sample code does not bring down the Vault APIs. Veeva suggests using IntelliJ IDEA IDE for developing your Vault Java SDK code. I use the community edition of that IDE. Follow the instructions described on the below link to get it all set up.

    https://developer.veevavault.com/sdk/#vault-java-sdk-overview

    There should be a pom.xml file that defines which version of the Java SDK is downloaded to your computer and used by the IDE. Update the below property to get the latest version which is 19.3.5.

    <properties>
    <vault.sdk.version>[19.3.5-release0, 19.3.5-release1000000]</vault.sdk.version>
    </properties>

    When a new version of the SDK becomes available, I update the version, and save the file. You should see the Vault SDK API in the External Libraries. If not, you may be able to pull them down by right-clicking on the pom.xml file, selecting Maven and Download Sources (I believe). I'm not an expert at using these IDEs but have been playing around with it a bit).

    Regards,

    John

     

    0

Please sign in to leave a comment.

Powered by Zendesk