Service Desk Practitioners Forum
cancel

SD Event and unique ID

Highlighted
John_Ellis
Regular Contributor.

SD Event and unique ID

I am using SD Event to create new service calls. I'm using modus=insert and using Source ID as my unique key, which I defined in import mapping. I am able to create a new service call if I specify the source ID as part of SD Event, but I'm trying to figure out how to do it without passing it in, since I won't know what the next source ID will be when SD Event is triggered. I'm wondering if there's a way for SD Event to just use the next available source ID automatically.

Any tips would be very much appreciate. Thank you.
7 REPLIES
JaS_4
Acclaimed Contributor.

Re: SD Event and unique ID

Hi John,

For my testing, I normally use env variable %time% for my source_id. To make it unique, you could use %date%%time%.
But I thought, you can map the source id to something else and use the normal unique key of incident which will pick up the next available id.
John_Ellis
Regular Contributor.

Re: SD Event and unique ID

I can't use date and time as a unique ID for a service call number because they are sequential. Somehow I need the Source ID to automatically use the next number in sequence, just like the desktop application does when a user enters a new service call.

For example, if the last service call entered was 100,000 then the next service call number has to be 100,001. Since we have a couple dozen people who use the desktop application to create service calls, I'm trying to figure out a way to get SD_Event to automatically use one number higher than the last service call number so we don't have any contention issues with calls entered using the desktop app.

I tried using the registration create date as my primary key and then I removed Source ID from the import map, hoping it would just automatically assign the appropriate number, but that didn't work. It seems to require Source ID to be passed in, but that is the source of my problem. How do I know what the next service call number should be? I'm afraid that if I try to read the last number from the database before submitting, then my SD_Event could overwrite a call entered by a desktop user if we saved at the same time. With a couple dozen users at our Help Desk constantly entering service calls via the desktop application, it's a real possibility.

I'm guessing there is something really simple I'm missing here, but I can't figure out what it is.
Sergiy Bilous
Trusted Contributor.

Re: SD Event and unique ID

I also use system variables %date% and %time%.
Getting the same key on two systems is almost impossible because the time is given in such format as "18:38:41,70".
Best regards!
MarkvL
Acclaimed Contributor.

Re: SD Event and unique ID

Hi John,

Looking at your description I feel that you mix up ID and source id.
the source id or oid is never sequencial(not even when created through the GUI), only the ID is.

Mark
HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution.
John_Ellis
Regular Contributor.

Re: SD Event and unique ID

Maybe I'm missing something obvious then. When I pass in a Source ID and then view the record in Service Desk, the ID that displays on the record is the same as the Source ID that I passed in. For example, I used a source ID of 690700 in SD_Event for Source ID and the call it created in Service Desk had a call ID of 690700. If I pass in %date% and %time% instead, it generates an error.

Basically, I just need Service Desk to generate the unique call record ID for me each time. Sorry, I'm just not understanding what I'm missing.
Vasily Kamenev
Acclaimed Contributor.

Re: SD Event and unique ID

HI
The strange discuss, unique key in SD_event need for define in Items unique properties,
So if you like use Source ID as Unique that your wishes and not more else. All must define your task, what are you like? If your task: like so SC from one email with one Subject registered only one time. Good, by sd_event subject your set in Description and email address from to SourceID, then in map you need set Description as Unique and SourceId as Unique too. in the next time the same email not be create, because our system had Item with the same Desc. and SourceID. But if you like create every time SC from this user, and not meter if event contain the same information, so build SourceId as email+time or create Rule where this function will executed and add to SourceID time parameters.

Vassili
JaS_4
Acclaimed Contributor.

Re: SD Event and unique ID

Hi John,

When I used sd_event to test OVO integration with SD, this are the parameters that I have used.
MAPPING=ovounix
CLASSNAME=incident
MODUS=insert
In the admin console, when I check the mapping ovounix and the Item Mapping incident, I find that the my mapping have event_id mapped to Source Id (unique key) and nothing on the description.
I'll run sd_event with description=%time% and event_id = %time% and I'll get an Incident record created with ID = 177 (system generated) and description = 10:03:05.51 so that I can identify my Incident easily. Its like what Mark said, the ID is system generated and is not affected by the sd_event commands. Once I add the field Source_id to my Incident view, I can see the Source_id = 10:03:05.51 as well. This is the field that's used by sd_event is not normally visible to the user. So if the source_id is set to %date%%time%, its unique enough to keep sd_event command happy and SD will assign its own ID as well. So its just a case of mistaking source_id for ID.