REST API question on Case Reference Id

Using the REST api i want to create a case.

I cannot see how to get the reference id. I would expect it in the api

http://{{server}}/sdata/{{install}}j/metadata/-/$service/getCustomObject?name= CaseDetailBox&SID={{sid}}

but its not set as a default value (tested on 2022r1)

If not there any suggestions on how to create this without causing duplicates later on?

  • 0

    I don't know about REST API, but just want to check that you are looking at the right field, that you're looking for case_referenceid and not case_caseid?

    Or are you asking how to generate the reference? within the CRM database this is generated by a Stored Procedure (basically it reads from the Custom_Sysparams table for the next ID number) 

  • 0 in reply to Matthew Shaw

    I mean the reference id.

    So in CRM its generated as you mention but in the REST api i cannot see it being generated and there is nothing in the documentation that i can see that mentions it.

    Maybe its not implemented and an oversight. We are assuming it is right now.

  • 0

    Please see:  (+) The Sage CRM StoredProc Data Type - Sage CRM Hints, Tips and Tricks - Sage CRM - Sage City Community

    Fields like case_referenceid and oppo_referenceid are of type 'storedproc'.  The use of the screen block to create the record is critical. The stored procedure will only fire when you create the record via the user interface.

    The field has to be used within a screen in order to invoke the storedprocedure.

    But the underlying physical datatype is just a nvarchar so we can pass in our own strings for example

    I can issue a 'post' to my instance of Sage CRM http://[servername]/sdata/[instancename]j/sagecrm2/-/cases

    with the following JSON in the Body

    {
    "case_primaryCompanyId": 28,
    "case_assignedUserId": 1,
    "case_description": "testz",
    "case_referenceid": "wibble",
    "case_SecTerr": -2147483640,
    "case_ChannelId": 5,
    "case_primaryPersonId": 30
    }

    Here I can quite happily create a new case with the reference 'wibble'.