CA Service Management

 View Only
  • 1.  Site Defined Condition to Identify User Access Type

    Posted Dec 09, 2019 12:12 PM
    Edited by Joel Barger Dec 10, 2019 12:45 PM

    I would like to introduce a site defined condition to prevent problems from transitioning to closed without a certain access type being applied to the currently logged in user. 

    For Example roughly site defined condition:

    user.access_type.sym = "Analyst MGR"

    How is this accomplished?

    Any help is greatly appreciated.

    #sitedefinedcondition
    #spelcode

    ​​​​


  • 2.  RE: Site Defined Condition to Identify User Access Type

    Posted Dec 10, 2019 02:33 PM
    Bump!


  • 3.  RE: Site Defined Condition to Identify User Access Type

    Posted Dec 11, 2019 11:22 AM
    Edited by Sigitas Grincevicius Dec 11, 2019 12:18 PM
    I created condition macro.



  • 4.  RE: Site Defined Condition to Identify User Access Type

    Posted Dec 11, 2019 11:20 AM
    Hello,

    Code of macro:

    uuid who;
    object zaccess;

    send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");
    who=msg[0];

    send_wait(0, top_object(), "call_attr", "api", "get_access_for_contact", (string)who);
    if (msg_error()) {
    logf(ERROR, "get_access_for_contact failed %s",msg[0]);
    }
    else
    {
    zaccess = msg[0];
    logf(SIGNIFICANT, "access: %s",zaccess.sym);
    }
    if (zaccess.sym=="Analyst MGR") {
    set_return_data(TRUE);
    } else {
    set_return_data(FALSE);
    }


  • 5.  RE: Site Defined Condition to Identify User Access Type

    Posted Dec 11, 2019 12:15 PM
    Thank you so much Sigitas I'll give this a whirl.


  • 6.  RE: Site Defined Condition to Identify User Access Type

    Posted Dec 11, 2019 12:17 PM
    Question, instead of returning true or false is there a way to provide just the access_type value so that way we can observe that rather than hardcoding it in?


  • 7.  RE: Site Defined Condition to Identify User Access Type

    Posted Dec 11, 2019 12:31 PM
    Of course you can check id of access type if you like.
    Please explain in more detail what do you mean by:
     provide just the access_type value so that way we can observe 


  • 8.  RE: Site Defined Condition to Identify User Access Type

    Posted Dec 11, 2019 12:37 PM
    in a site defined condition you can set it up so that you can observe the value of an attribute. is there a way to expose this attribute so rather than having a hard coded value in a spel script we have the ability to configure the value and re-use this if need be in other places.


  • 9.  RE: Site Defined Condition to Identify User Access Type
    Best Answer

    Posted Dec 11, 2019 01:13 PM
    Edited by Christopher Hackett Dec 30, 2019 04:37 PM
    If I understood correctly you want to set this access type from user interface.
    You can create in some object for example status custom attribute zaccess_type and add this field to status form.
    After that you can get this status in condition macro with dob_by_persid method and use in check.
    That way you can also get this access type in custom spell methods.