CA Service Management

 View Only

SPEL API methods 

Aug 04, 2015 10:13 AM

SPEL API methods are spel methods that are defined on API object, definitions can be found in api.maj file. It seems that these methods are used at the backend of SOAP web services.


To call methods defined on particular object we use the following construction:


send_wait(0,top_object(), "call_attr", "<object>", "<object_function>", <object_function_parameters>);


update_object_super This method allows to update multiple attributes for the object
insert_object This method allows to create object and define multiple attributes. You should not use this method to create objects that contains reference numbers (cr,chg,iss) since this method will not generate them automaticaly


This method allows to delete objects that meets defined criteria ( provided by cdtj)
get_access_for_contact This method allows to get contact access type information


This method allows to get code of functional access that is defined for the object
get_system_users This method will get privileged SDM users and their id's
get_attr_list_for_object This method will get all attributes for the object by object name
get_attr_information This method will get object attribute information
get_object_values This method allows to get object attribute values
generic_activity_log This method allows to create activity log for cr,chg and iss objects
notify_contacts This method allows to perform manual notification from spel code. Method will send an email and create activity log entry
add_requestThis method allows to create new request by using template or from the scratch. It also allows to populate properties if they are defined for the category


This method allows to create new change order by using template or from the scratch. It also allows to populate properties if they are defined for the category
add_issueThis method allows to create new issue by using template or from the scratch. It also allows to populate properties if they are defined for the category
get_valid_tasks_wcThis method gets valid workflow task statuses
get_workflowThis method gets number of tasks attached to the object


This method gets item list by where clause. Returns number of objects found and object list as the object. Most often it should be used in conjunction with get_list_values method
get_list_valuesThis method gets object attribute values from object list that is returned from get_list method
get_val_for_wc This method gets value of single object attribute by where clause
generic_status_change This method updates status of an object eg. cr, chg, iss (provided by utku.alp)
get_properties This method gets properties of the request, change or issue. Returns number of properties found and property list as the object. Most often it should be used in conjunction with get_list_values or dob_by_index method.
update_object This method allows to update multiple object attributes and atributes of related objects.
get_list_length This method gets object list length, the same length that is usualy returned in msg[1] by methods like get_list and etc.
api_select_count This method gets count of the objects by the where clause
fetch_more This method fetches more results to object list if not all of them where requested by get_list method.
delete_workflow This method allows to delete workflow task that is attached to the object (Atention: this method is not supported for request object for more info check the following thread request ticket - insert and delete WorkFlowTask )
add_contact This method allows to create new contact
add_workflow This method inserts workflow tasks for change and issue objects (provided by ConanLam ( (Atention: this method may not be supported for request object for more info check the following thread request ticket - insert and delete WorkFlowTask )

This method is used to get contact group membership information from grpmem table.


This method allows to create or delete lrel relation.



Will update this when more examples comes in.


1 Favorited
0 Files

Tags and Keywords


Jul 28, 2017 05:20 AM

Two words about regular methods and SPEL API: SPEL Optimization: Regular methods Vs SPEL API 

Apr 13, 2017 01:07 PM

Here's an example for using the method attach_chg_to_request.  I rebuilt the Create Change Order button that is displayed on RIP objects because it has a few bugs (E.g. the analyst doesn't save the Initial CO for longer than the time specified in the web.cfg ExclLockSeconds setting).  This custom solution calls attach_chg_to_request once a CO has been created from a request and will always associate the Request to the CO.  The request persid is mapped to the CO string6 field and this method is called whenever string6 changes.  Thank you camja06 for the idea!


MODIFY chg POST_CI zAttachChangeToRequest(persistent_id,string6) 100051 FILTER( string6 {} );



     // The following lines can be un commented for debugging
     string method;
     logf(SIGNIFICANT, "%s started", method);

     // End debugging lines
     // Variables required for this function are defined here
          string          crPersid, chgPersid, desc;
          uuid          who;

     // Argument values that were sent to the function are copied into their respective variables here
          chgPersid          =argv[3];
          crPersid          =argv[6];

     desc = "Change Order ";
     send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");

     send_wait(0, top_object(), "call_attr", "api", "get_object_values", who, chgPersid, 0, "chg_ref_num"); 
     if (msg_error()) { 
       logf(ERROR, "get_failed %s",msg[0]); 
     int i; 
     for (i=0;i<msg_length();i++) { 
       logf(SIGNIFICANT, "msg[%d]: '%s'", i, msg[i]); 
     desc += msg[1] + " created.";
     send_wait(0, top_object(), "call_attr", "api", "attach_chg_to_request", who, crPersid, chgPersid, desc);
     if (msg_error()) { 
       logf(ERROR,"Error %s",msg[0]); 
     logf(SIGNIFICANT, "%s ended", method);


Jan 27, 2017 09:23 PM

Hi Gutis,


When try to open the link for get_func_access method send to page, this send a error "No authorize".

Do you know something about this? Thanks...

Nov 02, 2016 05:17 PM

Have you tried to pass template persid instead of task code? Since WebService method accepts both parameters, i think this should work on spel level to.

Oct 31, 2016 04:56 AM

Hi Gutis,


Just found a reply from you in another thread, is there any way insert workflow tasks using a spel .


After trial and error, here is what I got so far:

add_workflow (uuid, //creator user id

string, //chg or iss object persid

string, //wf object persid where you want to insert the task after (if NULL it will insert at the end of the list)

string, //task type code

int, //this is the parameter I cannot figure out, it only takes 0, 2, or 4

//any other value you want to set (see example below)

attributes1, value1,

attributes2, value2



     send_wait(0, top_object(), "call_attr", "api", "add_workflow", who, "chg:402549", "", "APP", 0, 
               "group_task", 1,
               "wf_template", 400504,
               "description", "Auto Added Task 999");


Best regards,


Oct 31, 2016 02:35 AM

Hi Gutis,


Thanks for the document.

Do you know how to use the add_workflow method?

add_workflow (uuid, string, string, string, int, ... );


Best regards,


Dec 16, 2015 02:08 AM

good job Gutis , thanks for your effort.

Dec 16, 2015 01:40 AM

What a revelation! One more huge step to total control over CA SDM!

Dec 15, 2015 05:46 PM

It seem that callServerMethod even allows to execute spel code that are defined on the object. I was able to execute the api:api_select_count method


<soapenv:Envelope xmlns:soapenv="" xmlns:ser="">









            <!--1 or more repetitions:-->


            <string>active = 1</string>







got the following answer:

<soapenv:Envelope xmlns:soapenv="" xmlns:xsd="" xmlns:xsi="">


      <callServerMethodResponse xmlns="">

         <callServerMethodReturn xmlns="">&lt;?xml version="1.0" encoding="UTF-8"?>&lt;ServerReturn>






Dec 15, 2015 05:37 PM

Now i am almost sure that api methos are used by CA SDM SOAP web services and was created as the backend for them.

Dec 11, 2015 08:17 AM

update_object method revealed

Dec 10, 2015 08:27 AM

Thank You, guys!


Check out the new API method get_properties

Dec 10, 2015 02:17 AM

great job, thanks to both of you Gutis and Chris Hackett

Dec 09, 2015 07:58 PM

Agree! Bravo. This article keeps on getting better and better.


Chris_Hackett - Do we still do featured articles? I'd like to suggest popping this one up there for a week.


Thanks, Kyle_R.

Dec 09, 2015 06:13 PM

Since document grow to big and it was almost imposible to add new content, i have splited it into multiple small documents, from now on this document will serve as the main blog for all others detail SPEL API documents. Chris_Hackett thank you for idea.

Dec 03, 2015 03:05 AM

Thank You utku.alp, i have updated document.

Nov 27, 2015 09:20 AM

Sorry if this is a duplicate message for this method




updating status of requests (i guess already available for issue and change



generic_status_change ( uuid, string, string, string ) ;

uuid - user id

string - persistent_id of the object

string - description

string - status persid


uid who;

send_wait(0,top_object(), "call_attr", "cnt", "current_user_id"); 


send_wait(0, top_object(), "call_attr", "api", "generic_status_change", who, "cr:644851", "Status change description", "crs:5212");

if (msg_error()) { 

  logf(ERROR,"Error %s",msg[0]); 


Nov 25, 2015 03:55 AM

I have just tested it by calling getObjectTypeInformation method on cnt object, and the only attribute cost of type double contains datatype value 2006. Since all methods are using strings to pass values, i think that this chapter describes general CA SDM datatypes, and an answer from CA is not quite correct.

Nov 25, 2015 03:22 AM


i did my statement based on method you described in this document:


if i use it with attribute with data type DOUBLE,

i receiving 2006 as result.


But everything above is true for SPEL and WebServices is another thing.

As I remember all attributes via WebServices are passes as strings within array, so data type didn't matter on WS layer.

Also I reviewed WSDL file and didn't noticed any methods to get Data Type.


Also I want to notice that DOUBLE format in SPEL have some problems (or better call it rules?),


int a;

printf(a); // NULL

a = a + 1;

printf(a); // 1

// incorrect

double b;

b = b + 1; // b = NULL;

// correct

double c;

c = 0;

c = c + 1; // c = 1;

but this kinda offtopic : )

Nov 25, 2015 02:42 AM

Hi Kyle I have asked to review documentation, and received the following answer:

Hi Giedrius,

The datatype listed on this page are for the Webservices layer. The value 2006 is an UNKNOWN data type on the webservices layer. The webservices layer datatype do not match exactly with the backend datatype.

cdtj can you comment on this? Since i still have doubts about this.

Nov 09, 2015 02:24 PM

fetching properties of Change order before save   any thing i had missed here!  , I am using get_object_values and get_list methods .

Oct 29, 2015 11:14 AM

Just checked those methods can be used with each other

Oct 27, 2015 06:37 PM

Two new methods:

get_list - very similar to sync_fetch

get_list_values - similar to dob_by_index, but instead of objects, this method gets values for defined attributes for the object.


Most probably sync_fetch can be used in conjunction with get_list_values and vice versa get_list in conjunction with dob_by_index. Did not tested that.

Oct 20, 2015 06:41 PM

Those were tricky ones, but anyway new methods are available




Oct 16, 2015 10:04 AM

New methods generic_activity_log and notify_contacts

Oct 16, 2015 03:30 AM

Great document , I'm just a little sad for finding this article too late.

Sep 25, 2015 09:25 AM

New method added get_object_values

Sep 19, 2015 02:51 AM

Thank you cdtj, i have changed document. Please feel free to update this document by yourself.

Sep 04, 2015 06:24 AM

Hi Giedrius,


Could  you (a) Check the above post from Timur, check the ITSM 14.1 documentation on the Wiki to see if it is stored there and if so, make a request to review the document and (b) change font size in opening paragraph back to normal size - it seems to have picked up the title text size.


Thanks, Kyle_R.

Sep 04, 2015 05:54 AM

little notice about get_attr_information:

  1. //UNKNOWN 2006

is described as UNKNOWN in Admin/Impl guide but it's not true,

2006 - is float/double data type. (WSP: DOUBLE; SPEL: could be defined as float or double);


This doc is not correct place to discuss about data types but search pointed me here :)

Aug 06, 2015 09:11 PM

Fantastic article. More SPL documentation is always needed and appreciated.


Thanks, Kyle_R.

Aug 04, 2015 02:09 PM

Thank You, Tiago!

Aug 04, 2015 12:49 PM

Aug 04, 2015 11:44 AM

Great. Very helpful.

Aug 04, 2015 10:31 AM

Great article, haven't faced this functions before!

One common method from me:

Delete object:

send_wait(0, top_object(), "call_attr", "api",

    "delete_wc",           // function name

    factory,                  // factory

    whereclause,          // where clause



Usage example:

uuid cnt_id;


send_wait(0, top_object(), "call_attr", "api", "delete_wc", "grpmem", format("member=U'%s'", (uuid)cnt_id), NULL); // remove membership of cnt_id from all groups;

Related Entries and Links

No Related Resource entered.