CA Service Management

Expand all | Collapse all

Classic Workflow Control Based on Property Value Selction

Jump to Best Answer
  • 1.  Classic Workflow Control Based on Property Value Selction

    Posted 01-17-2017 09:49 AM

    Hello All,

    I came around a situation where we need skip a classic workflow automatically based on a specific value selection from Category-->property DropDown. Is that technically possible? The Classic workflow runs on cr object and property dropdown is either Yes or No. If Property is selected as "Yes" the workflow should auto skip else it should follow the normal approval process. How can we achieve it?

     

    Thanks

    ArunavaS



  • 2.  Re: Classic Workflow Control Based on Property Value Selction

    Posted 01-17-2017 11:01 AM

    Hi Arunava, 

    Unfortunately out of the box there are no triggers for a relationship between properties and wf tasks.  Some folks may have come across this before and have come up with a customization that they are willing to share with you here on the community, but its not something we can assist with as its outside the scope of support.

    Does anyone have anything they can share with Arunava on this subject?

    Thanks,

    Jon I.



  • 3.  Re: Classic Workflow Control Based on Property Value Selction
    Best Answer

    Posted 01-17-2017 12:05 PM

    hi,

    you can create simple macro which will fetch properties from change/request and will change status if prop match your condition. Macro could be attached to to inital task's status behaviour.

    Macro could be (not test):

    // you can use label or better owning_rule id in search criteria
    send_wait(0, top_object(), "call_attr", "cr_prp", "sync_fetch", "STATIC", format("owning_cr = '%s' AND label = '<YOUR_LABEL>' AND value = 'Yes'", cr.persistent_id),  -1, 0);
    if (!msg_error()) {
         // msg[1] containt rows count, 0 means zero matching
         if (msg[1] == 0) {
              // action for zero matching, skip task for example
              send_wait(0, this, "call_attr", "status", "set_val", "SKIP", "SURE_SET");
         } else {
              // other action here if needed
         }
    }

    Regards,

    cdtj



  • 4.  Re: Classic Workflow Control Based on Property Value Selction

    Posted 01-17-2017 01:33 PM

    Great! Thanks for this prompt answer cdtj. I was exactly looking for something like this. I will try this in my test box and will let you know the result.

     

    ArunavaS



  • 5.  Re: Classic Workflow Control Based on Property Value Selction

    Posted 01-18-2017 07:44 AM

    Hello cdtj,

     

    Thanks again for your help on the action macro code. Yes, the code is working smoothly in my test environment, though I made a slight modification in your code. I believe msg[1] must return 1 if the record found and having said that it worked in that way in my environment. I must consider your response as the correct answer. Thanks a ton.


    send_wait(0, top_object(), "call_attr", "cr_prp", "sync_fetch", "STATIC", format("owning_cr = '%s' AND label = 'Does this Product already exist in Service Desk' AND value = 'Yes'", cr.persistent_id), -1, 0);
    logf(SIGNIFICANT,msg[1]);
    if (!msg_error()) {
    // msg[1] contain rows count, 1 means record matched
    if (msg[1] == 1) {
    send_wait(0, this, "call_attr", "status", "set_val", "SKIP", "SURE_SET");
    } else {
    logf(SIGNIFICANT,"In Else Block");
    }
    }

     

    ArunavaS