Clarity Service Management

Expand all | Collapse all

How to insert_object cr_wf in spl code

Jump to Best Answer
  • 1.  How to insert_object cr_wf in spl code

    Posted 10-02-2019 09:44 AM
    Hello,
    we are trying to insert CR_WF if some category ticket is created and had no parent tiket but we are unable to do this with insert_object spel api method. It gots no error which could be specified in std.log but keeps time-outs which is super anoying to debug.

    We have a following code:
    uuid who;
    object newObject;
    send_wait(0, top_object(), "call_attr", "cnt", "current_user_id");
    who=msg[0];
    send_wait(0, top_object(), "call_attr", "api", "insert_object", who, 'cr_wf', NULL, 0, "object_type", 'cr', "cr", persistent_id, "sequence", 20, "task", "APP", "wf_template", 400060);

    Do you anybody please know if CR_WF object can be created via this api method? because CA 17x have some issues with add_workflow and delete_workflow for CR_WF factory.

    Thank you very much in advance for any hint.

    Best regards,
    Petr P.


  • 2.  RE: How to insert_object cr_wf in spl code
    Best Answer

    Posted 10-06-2019 01:44 PM
    This method should allow you to insert any object. As I understand you are using trigger to insert this task. I had some troubles with this method when I was using POST_VALIDATE and PRE_VALIDATE triggers. Please try to use POST_CI trigger, in this case you will need to pass persistent_id from trigger, since context object will be not available in script context.


  • 3.  RE: How to insert_object cr_wf in spl code

    Posted 22 days ago
    Hello,
    Thank you for your suggest. But after long debugging, it was caused by collision of multiple others spell tasks but with object crwf.
    I was creating object from CR object, but we have some validation assigne spells on insert event for cr_wf object and it was caused theese loong timeouts.
    So I have to do a propper filtration on .mod level, and call .spel api methods only when neccessary and it works well now.

    Thank you again for you time.

    Best regards


  • 4.  RE: How to insert_object cr_wf in spl code

     
    Posted 22 days ago
    Thanks for the technical update on this issue, Petr.

    SPL code can look "easy" at some levels but can be "hard" in practice because of interactions like this.


    Thanks, Kyle_R.