Integration Bus GetInternalObjectParams() example

Citro Digital asked on November 20, 2015 22:51

Can anyone supply a better GetInternalObjectParams() method implementation than this?

public override void GetInternalObjectParams(int id, string objectType, out string codeName, out string siteName, ref int parentId, ref int groupId)
{
    // Based on given identifier and object type you should be able to identify object in your (external) application and return its parameters (marked as 'out')
    codeName = null;
    siteName = null;
    parentId = 0;
    groupId = 0;
}

I'm trying to map an om.accountstatus to an incoming om.account by setting the om.account's AccountStatusID during the PrepareInternalObject() method, however when I save the AccountInfo object using the AccountInfoProvider, it does not save the AccounStatusID to the database. I'm thinking it may be the GetInternalObjectParams method, however I have no clue on how to imlement this method since the documentation and examples are limited.

Correct Answer

Timothy Fenton answered on November 23, 2015 11:27

Hello, so in this method you are basically trying to take the id and object type and get the codeName ( the out param ) of your kentico object to be set from that. To do that you could do something like:

//get the codename and assign it to the out paramater
codeName = AccountStatusInfoProvider.GetCodeName(objectType, id);

you could also set the sitename to be more specific if you are trying to deal with only one site.

You can try setting just the codename and see if it helps your current code

0 votesVote for this answer Unmark Correct answer

Recent Answers


Citro Digital answered on November 23, 2015 15:54

Thanks Timothy!

This example was exactly what I was looking for. The status mapping now works. Using the example you provided I just changed out AccountInfoProvider with AccountStatusInfoProvider.

if(objectType == AccountStatusInfo.OBJECT_TYPE)
            {
                codeName = AccountStatusInfoProvider.GetCodeName(objectType, id);
                siteName = SiteContext.CurrentSiteName;
                parentId = 0;
                groupId = 0;
            }
0 votesVote for this answer Mark as a Correct answer

Timothy Fenton answered on November 23, 2015 16:00

glad it is working for you!

I updated my answer to match your change to AccountStatusInfoProvider for accuracy's sake... thanks for letting us know it solved the issue!

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.