CA Service Management

 View Only

Where can I find Spel functions documentation? 

Jun 06, 2015 07:14 PM

What is spel

Spel is a procedural language closely resembling C, with some additional statements for handling the Business Object Process (BOP) messaging architecture.

(Integrations Vol2 p124)


  • Spel is CA proprietary code language script for CA Service Desk Manager where is a interpreted language executed by Method Engine called SPEL_SRVR  - "Spel code interpretation server" (CA WIKI)
    • Spel code can be interpreted not only by spel server but also by webengine if it is placed in www directory and defined as custom webengine operation, know how more SPEL: Register custom webengine OP by cdtj
  • All changes using spel changes on CA Service Desk Manager will change factory standard
  • All changes using spel code it´s a customization and don't have support by CA Support. (CA Support Brief)
  • All custom changes on CA SDM is  located in $NX_ROOT\site\mods\
  • Spel code can be found in .spl and .maj files located in $NX_ROOT\bopcfg\majic and $NX_ROOT\site\mods\majic directories. (Integrations Vol2 p122)
  • Examples can be found in the $NX_ROOT\samples (CA WIKI)
  • .spl files with a pcd preceding the .spl are encrypted files, such as chgpcd.spl or itilpcd.spl.
  • We are using usually spel to do attribute validation and/or notification


Be Careful

By Kyle_R

WARNING: Incorrect SPL code customization can stop your system

Click here for more information


Data Types

int 32 bit integerlong 32 bit integerfloat or double (same)
datedurationstring C++ object
object BOP objectuuid


Logical operators

A programming-language symbol that denotes a logical operation, are generally derived from Boolean algebra, which is a mathematical way of manipulating the truth values of concepts



Logical operator AND.



Logical operator OR



logical or bitwise OR


Relational operators

Relational operators allow comparison of values. (know more...)



Equal to


Not Equal to


Less than or equal to


Less than


Greater than or equal to


Greater than

x == yx != yx <= yx < yx >= yx > y


Arithmetic operators

Arithmetic operators able to add, subtract, multiply, and divide. (know more...)




Concatenation operators

Concatenation is the process of appending one string to the end of another string. When you concatenate string literals or string constants by using the + operator, the spel creates a single string.




Assignment operators

Assign a value to a name. (more...)


simple assignment
Compound addition
Compound subtraction
Compound multiplication
Compound division
Compound modulo





Conditional statements are evaluated condition where are compared values,  Example: if (x % 2 == 0)



Loops are used in performing repetitive task in programming.



Loop statement in programming language repeatedly executes a target statement as long as a given condition






SPEL API methods






msg_length(), which returns length of msg array after send_wait usage


Example Code:


for (i=0;i<msg_length();i++) {

    logf(SIGNIFICANT, "msg[%d]: '%s'", i, msg[i]);





SPEL: Object update


upd_val, update objects


Example code:



  1. macro::upd_val("iss",                          // object factory 
  2.               format("id=%d",other_issue_id), // where clause to get object (or objects) 
  3.               30,                            // delay to new retry if first iteration fails 
  4.               3,                              // amount of retries 
  5.               "summary",                      // attribute to update 
  6.               "test 1",                      // new value   
  7.               "description",                  // another attr  
  8.               "test 2",                      // another value   
  9.               "z_etc_param",                  // amount of attributes that can be updated in 1 iteration is infinite   
  10.               "here is etc value");          // value can be string, integer or anything else. 


Spel files and Advanced Availability

1. create your files

2. run pdm_server control -b on standby it will become background

3. run pdm_server_control -v on standby former background

4. run pdm_server control -b on standby former background it will become background

5. restart standby and application servers

By Gutis


Makes SPEL code easier to understand


References - To find out more about Spell, then go to:



Technical Reference Guide Release 12.9.00

CA SDM Spell coding - How to recycle Spel Service - (spel_srvr)

SPEL: Dummy atevs cancellation 

SPEL: HTML styled notification via SPEL ( cdtj )

SPEL: How to call SDM method using WebServies 

Custom WebEngine OP : Who is currently watching object

SPEL: Object update (cdtj )

SPEL: Register custom webengine OP


SPEL API methods (Gutis)

SPEL API: BOP Manual  Chapters

SPEL API: Overview

SPEL API: Lessons

SPEL API: BOP - Executables

SPEL API: BOP Interpretive C Language

SPEL API: BOP - Schema - Majic

SPEL API: Domain Server Public Messages

SPEL API: Domain Server - Attached Events

SPEL API: VBOP Detail Description




Update Change Status based on Task Status using SPELL. by Fabiano Domingues 



 Service Desk Manager 15 days Implementation 





Tiago Macul




 Daniel Bighelini 

Tiago MACUL's Blog





Was useful, please leave your feedback!

2 Favorited
0 Files

Tags and Keywords


Mar 27, 2020 06:17 AM

I'm looking for spel (spell?) documentation, but the links provided at the end of this article are broken:

SPEL API: BOP Manual  Chapters

SPEL API: Overview

SPEL API: Lessons

SPEL API: BOP - Executables

SPEL API: BOP Interpretive C Language

SPEL API: BOP - Schema - Majic

SPEL API: Domain Server Public Messages

SPEL API: Domain Server - Attached Events

SPEL API: VBOP Detail Description



They forward to a page "Object move to Here". But the "Here" link loop on itself.

Could you update them?


Mar 20, 2018 01:53 PM

tks updated.

Mar 16, 2018 02:58 AM

Hi Tiago,


The hyperlinks near the end of the "Functions" section appear to be mismatched.

For example, "get_gmt_date" points to "CA SDM::.SPEL::. get_background_server()".


Thanks, Kyle_R.

Feb 21, 2017 12:59 PM

I've included several SPEL functions discovered in the "Functions" section. I will document them gradually. Some of them have not yet figured out the correct syntax.

Feb 15, 2017 06:27 AM

Hi Tüker ,


Document updated.


Thank you for collaborating and improving this post. 




Feb 15, 2017 01:28 AM

Hi Tiago,


Can you add "uuid" datatype for hex-decimal id format for such as contact_uuid or organization_uuid datatypes to "Data Types" section of this document. This datatype is missing.




Jun 22, 2016 05:30 AM

Hi Daniel,


Thanks a lot for sharing these documents, I hope many will get benefited.




Jun 14, 2016 06:19 AM

That's Great Collection and helpful indeed!

Jun 13, 2016 04:56 PM

Ok. I will keep separated articles.

[ ]s

Jun 13, 2016 04:39 PM

Daniel, thank you for sharing!!!

I would also suggest you to start separate document where you will keep all links to your documents.

Jun 09, 2016 04:28 PM

Daniel, you are the best!

Jun 09, 2016 04:24 PM

I have good news to give to all of you.
I'll share here all OFFICIAL documentation SPEL I have. I got this documentation because I had the opportunity of CA professionals who participated in a SPEL development workshop.
This documentation is very rich and I'm sure will help many to improve their knowledge in the same way that I did.
Next Monday (13/06) will publish the 17 documentation files I have.
Await news.



cdtj, Gutis,

Jan 18, 2016 07:27 AM

simply want to add, that I haven't seen any code examples with break operator, but it works well.


int i, j;

j = 0;

for (i=0;i<100;i++) {

    if (j++ == 30) {




printf("j = %d\ni = %d\n", j, i);  // (j = 31, i = 30)

Nov 01, 2015 05:38 AM

Found one more useful function :

set_ilimit(int) - changes amount of max operations per function (sorry for that description ),


if you try to run macro like this:

int i, j;

while (i==0) {




it will crash with error: Spell interp failed at <MACRO>.spl:<LINE>:<METHOD>: limit exceeded,

to prevent it, you can increase operations limit via this func.

Warning! Long loops can cause performance issue!

Oct 16, 2015 02:35 AM

I think overview needs to be revised. As per cdtj post SPEL: Register custom webengine OP spel code can be interpreted by webengine and spel files located in site/mods/www.

Sep 30, 2015 05:00 PM

Sorry i am wrong, if you created this files manauly version control was not supressed on background server. Webscreen painter do this automaticaly on schema publish. So you need to do this manualy:

1. create your files

2. run pdm_server control -b on standby it will become background

3. run pdm_server_control -v on standby former background

4. run pdm_server control -b on standby former background it will become background

5. restart standby and application servers

Sep 30, 2015 04:48 PM

Most probably you messed up the sequence and background server was synchronized with standby configuration

Sep 30, 2015 04:46 PM

Hello guys,


I don't know if here is the right place to ask this, but here it go: I was doing some code for a SDM 14.1 instance in Advanced Availability. I placed both spl and mod files in site/mods/majic folder of Background server. When I restarted SDM Service (using pdm_server control -b in Standby Server and then in Background), the two files simply vanished! I noted that, for some reason, SDM deleted them when it was starting. Is there any explanation for this?

Aug 11, 2015 03:37 PM

HI Kyle_R,


   Thank You for your contribution, we really need pay attention on our code. I  referred your comment on document.




Aug 06, 2015 08:45 PM

Hello Tiago,


Thank you for posting this. This is the best guide to SPL that I've seen.


I note that the opening text and content is identical to the Service Desk Uses site. Under fair use, I don't think we can't just lift whole sections from another site - not without obtaining permission anyway. However, if those sections exist within our documentation, we can reference and extract from them. For example, searching on the opening phrase "Spell is CA proprietary code used to script Service Desk core operations" against our documentation, I can't find that string. Unless it is in an obscure piece somewhere. I would urge you to check out whether we have permission to post this, as it is not simply an extract but the page of the site.


Hello Everyone,


As wonderful as it is to have more SPL code documentation, and as powerful and flexible as SPL code customisation can be, I'm going to put my "Support hat" on for a moment.


I have chosen my words carefully below, so heed them well before embarking on SPL customisation.


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


! ! ! CAUTION ! ! !


Incorrect SPL code customisation can prevent your system from starting, running or introduce serious data integrity issues in the Service Desk Manager application.


Incorrect SPL code customisation failures may not be obvious, but introduce subtle yet serious issues only apparent after significant time has passed.


SPL code customisations and data recovery from SPL code customisations are not covered by CA Support.


For these reasons, if considering SPL code customisation, I would recommend that you:

  • Have in-depth experience with Implementing and Administering a standard CA Service Desk Manager system.
  • Have coding experience.
  • Have the resources available for test environment, QA and on-going maintenance over the life-cycle of the system - including future upgrades.


You may engage a CA Business Partner or CA to perform customisation work rather than doing it in-house. Typically scenarios are offered:

  • The customisation and documentation is provided as a "one off."
    The cheapest option. No on-going maintenance. Upgrades likely not included.
  • Customisation provided with on-going support on the current release by the provider.
    No new features, but will debug and address if an event like a patch or new integration has an impact.
  • Full service. The customisation is brought into the CA QA test cycle for ongoing future releases.
    Likely the most expensive, but it guarantees that the works is covered by CA and will work after upgrade.


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Hopefully these Communities can help you avoid some of those pitfalls, as SPL code is frankly the best tool for some jobs and you can achieve some wonderful things with it.

It is never to be taken lightly though.

Thanks, Kyle_R.

Aug 06, 2015 01:59 PM

Hi Gutis, than you, increasing this document.

Aug 06, 2015 12:09 PM

Hi, here are some functions that will allow to get some basic info about logged in user from the spell code. Since spel code from triggers is run under supervisor account this information allows to get security information (e.g. function acces level) and enforce constrains manually.

this will log information to log file:

logf(SIGNIFICANT, cnt::get_login_user_role_name());

logf(SIGNIFICANT, cnt::get_login_user_interface_type());

logf(SIGNIFICANT, cnt::get_login_user_grant_level());

logf(SIGNIFICANT, cnt::get_grant_level_string_val(cnt::get_login_user_grant_level()));

Aug 04, 2015 11:03 AM

Thanks Gutis.

Aug 04, 2015 09:01 AM

HI Gutis, thank you for contribution on improving this post.

Aug 03, 2015 05:06 PM

To update multiple attributes in one call you can use the following construction:


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

send_wait(0, top_object(), "call_attr", "api", "update_object_super", who, persistent_id, 0, "is_asset", "0", "is_ci", "1");


In this case all you need to know is the persistent_id of the object you want to modify. And then you can define multiple name-value pairs to update this object

Jul 24, 2015 05:24 PM

Thanks for sharing this.

Jun 22, 2015 03:36 PM

I have a dream, that someday CA will share some unencrypted .spl files from previous currently unsupported versions


Jun 19, 2015 04:34 PM

Hi cdtj,


   Thank You for add information.


   improving knowledge.


   DOC was uptated

Jun 15, 2015 04:12 AM


please add information about sleep(int delay) function,

a year ago i have lost a lot of time trying to get it work correctly...


here is code sample from macro_lock.frg

// checkout the spell macro so we can close it.

// keep trying every second until the checkout is successful.

int err_stat;

err_stat = 1;

while (err_stat) {

  send_wait(0, group_leader, "checkout", dob_ref);

  if (!msg_error()) {

    err_stat = 0;

  } else {

    sleep(1); // 1 second





Also there is one unremembered helpful function - msg_length(), which returns length of msg array after send_wait usage.

Usage example:

for (i=0;i<msg_length();i++) {

    logf(SIGNIFICANT, "msg[%d]: '%s'", i, msg[i]);





Related Entries and Links

No Related Resource entered.