CA Service Management

 View Only
  • 1.  Text API method

    Posted Aug 16, 2019 02:25 PM
    I´m using maileater to open tickets in service desk and I use textapi to populate several ticket fields.
    I have a custom field in call_req table that is an srel to another custom table.
    I need to create a new method for textapi to populate this custom field with maileater, but I didn´t find information on how to create it.


  • 2.  RE: Text API method

    Broadcom Employee
    Posted Aug 19, 2019 12:52 AM

    Hello Paulo,

    Check out the Keyword Conversion Methods here:

    https://docops.ca.com/ca-service-management/17-2/en/reference/ca-service-desk-manager-reference-commands/technical-reference/ca-sdm-text-api-interface#CASDMTextAPIInterface-KeywordConversionMethods

    And look at the existing text_api.cfg for "lookup" examples. You should find something similar. 

    Also, this is on a third party site, but it may be of interest:

    http://greggsmith.net/wiki/index.php/Custom_Lookup_method_for_TextAPI


    Thanks, Kyle_R.




  • 3.  RE: Text API method

    Posted Aug 19, 2019 09:42 AM
    Hi
    I need to create a new method, but tye link for third party not helped.
    I was not able to create the method according this site.


  • 4.  RE: Text API method

    Posted Aug 19, 2019 12:28 PM
    So we did something similar to this.  We created a column in call_req called z_reporting_location -> SREL to repmeth table.  Setting this up for use via Maileater required:

    1. Updating the $NX_ROOT\site\text_api.cfg.  Added the following custom entry to the bottom of the file "REQUEST.REPMETH=z_reporting_method.INTEGER.zreploc".  
    2.  Adding a SPL script to $NX_ROOT\site\mods\magic.  We called ours "lookup_repmeth.spl".  Contents as follows (remove quotes):
    "int zreploc(...) {
    string value;
    value = argv[0];
    logf(SIGNIFICANT, "z_reporting_location: %s", value);
    return 7300;
    }"
      We wanted this to default to id = 7300 (e.g. email) of the repmeth table
    3.  Cycle SDM Services.
    4.  Update your Mailbox rule if using.  We added the line "REQUEST.REPMETH=E-Mail" which works well for us.


    Hope this helps


    Derek~



  • 5.  RE: Text API method
    Best Answer

    Posted Aug 19, 2019 03:08 PM
      |   view attached
    Hi Paulo,

    Perhaps the following will help:
    // Example custom lookup method for Text API
    // this needs to be saved in the ..\site\mods\majic folder as a file with the extension .spl
    // ##########
    // This exanple assumes the schema update:
    //   An object has been defined with the name z_custom_table that has (at least) the following attributes:
    //     id (Integer)
    //     sym (String)
    //   An attribute (e.g. z_custom_attribute) has been added to the target object (e.g. cr) that is an SREL to the z_custom_table
    // ##########
    //
    // Set interpreter option that all variables must be explicitly declared
    #define SYNTAX STRICT
    
    int lookup_matchingID_by_symbol(string symbol, string obj_type, object obj, string attribute) {
    
      string method;
      method = "lookup_matchingID_by_symbol";
      int matchingID;
      logf(MILESTONE, "%s: Entering method: %s", method, symbol);
      logf(VERBOSE, "%s: obj_type=%s", method, obj_type);
      logf(VERBOSE, "%s: attribute=%s", method, attribute);
      logf(VERBOSE, "%s: obj.id=%s", method, obj.id);
    
      matchingID = (int)expand(format("&{'%s' = z_custom_table.sym->id}", symbol));
      if (is_null(matchingID)) logf(MILESTONE, "%s: %s not found", method, symbol);
      else logf(MILESTONE, "%s: %s found", method, symbol);
    
      return matchingID;
    }
    
    // Then an additional line must be added to the text_api.cfg file to use the method.
    // Let's say that an attribute named z_custom_attribute has been added to the cr object and will be used for Request tickets:
    // REQUEST.CUSTOM_VALUE=z_custom_attribute.INTEGER.lookup_matchingID_by_symbol
    //
    // Finally, Service Desk must be restarted for this to take effect.
    I offer this as an example and do not warrant its use.

    Cheers,
    Lindsay

    ------------------------------
    Lindsay Estabrooks
    Principal Consultant
    IT-EDU Consultants
    ------------------------------

    Attachment(s)

    txt
    Lookup_method_example.txt   1 KB 1 version