Skip to Content
avatar image
Former Member

How to write WF script to retrieve field value in UDO

Hello Professionals,

We are trying to implement a simple workflow, to get a field value in user defined object. This value might be 0 or 1, if 0 the workflow will go in path and if 1 it will go in another path.

We have a problem in writing a script to get this value, we have tried several ways with no hope, there is no full document explaining how to write scripts with UDOs.

which class should I use, CurrentProcess.DataObject(UDO Name), or, CurrentProcess.B1Obj(UDO Name), after that, how can I read a specific field value?

Any help would be highly appreciated,

Thanks in advance

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Dec 26, 2014 at 05:32 PM

    any updates?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I did a deep search to find any resource other than How to Configure workflow naive book with its Workflow APIs manual. I can't believe that there is no official material from SAP to cover Workflow Scripts to leverage the workflow usage.

  • avatar image
    Former Member
    Jan 05, 2015 at 04:55 PM

    Any updates?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Manish Meshram

      Yes, but be informed that the resolutions that I will mention might be illogical,

      Our main issue was how to deal with UDOs in workflows,

      From online samples we have successfully built this code block

      var frozenType=Utility.getEnumValue(bp, "FrozenType", "tYES");

      var validType=Utility.getEnumValue(bp, "ValidType", "tNO");

          var docUDOService = company.getGeneralService("upgradeform");

          var docUDO;

          var docUDOParam = docUDOService.getGeneralDataParam();

         

           var dobj=CurrentProcess.DataObject('dataObject1');  

          docUDOParam.put("DocEntry", dobj.getItem('Key'));

          docUDO = docUDOService.getByParams(docUDOParam);

       

          docUDO.put("U_Status", docUDO.get("Assigned to Team Leader"));

         

          docUDOService.update(docUDO);

      This code used to change Status field in the upgradeform UDO to "Assigned to Team Leader".

      Try to use this code, if it didn't work, and you got an error stating that service doesn't exist, delete your object, tables, and everything. Then, register it again but name it with lowercase letters, and make sure that Workflow services are stopped while you are registering the object.

      After doing all of this, re-try the code and let me know what you got.

      Good luck,