Skip to main content
Veeva Support US Holiday: Jul 4th - Limited staff, please plan accordingly

Community

Search

Welcome to Community

Getting error "Use of method [valueOf] in class [java.lang.Float] is not allowed]"

Answered

Comments

3 comments

  • Official comment
    Isak Thomas

    Hi,

    When getting, setting, and performing mathematical operations, Vault Java SDK requires you to use either BigDecimal or Number type. BigDecimal is typically used as it provides basic mathematical methods. 

    https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html

  • Gupta, Ritika

    Hi Isak

    Thanks for your suggestion. Can you please share any sample code it would be very helpful

    0
  • Isak Thomas

    Here is a snippet of some code that updates a number field on a document:

    DocumentService documentService = ServiceLocator.locate(DocumentService.class);

    //Assume documentVersion exists already
    BigDecimal number = documentVersion.getValue("my_number_field__c", ValueType.NUMBER);

    DocumentVersion documentToUpdate = documentService.newDocumentWithId("document_version_id");

    BigDecimal updatedNumber = number.add(new BigDecimal(1));

    documentToUpdate.setValue("my_number_field__c", updatedNumber);

    //Save document after setting the value
    0

Please sign in to leave a comment.

Powered by Zendesk