rbf_getIdByOriginalId()
Purpose
Given the original ID and an entity type, passes the entity's ID to the
specified callback function. If an entity of the
specified type with the specified original ID does not exist, sets the HTTP status
to 500 and executes the error callback function configured using rbf_setErrorsCallback().
rbf_setErrorsCallback(), you will still see the HTTP status of 500 but will not see the reason for the error.Syntax
rbf_getIdByOriginalId(entityType, originalId,
callback);
Parameters
entityType
A string indicating the type of entity. Can be one of "object", "field", "relationship",
"webpage", "view", "template", "report", "chart", "gauge", "trigger", "process", "status", "action", "button", or "datamap".
origId
The original ID of the entity.
callback
The callback function that will receive the ID of the entity as its first parameter.
Return value
If successful, passes the entity's ID to callback function and sets the HTTP status to 200. If unsuccessful, sets the HTTP status to 500 and passes the error
message to the configured error callback function (see above).
Note: This API is supported in portals as well.
Example
The following example retrieves the ID of the specified object definition and outputs it to the console. If there is an error, the error callback function displays an alert with an error message:
<script>
var callback = function(errMsg, apiName) {
alert("ERROR: "+errMsg+" in: "+apiName);
}
rbf_setErrorsCallback(callback);
var handleResponse = function (id) {
if(console){
console.log("**** Processing handleResponse ****");
console.log("ID is: ", id);
}
}
rbf_getIdByOriginalId("object", "7550", handleResponse);
</script>
With successful execution, the object definition's ID is printed to the console:
ID is: 150049675
In the above example, If there is no entity with the specified original ID, Platform displays the following alert: