function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mandycmandyc 

Problem creating a self-service user MALFORMED_ID: bad id lgQFM4sP

Hello,

 

I have a workflow that calls an outbound message (OM) and passes the following values: email, firstname, lastname, id, self_service_password__c.

 

When the OM fires, I receive the following error: MALFORMED_ID: bad id lgQFM4sP. lgQFM4sP is the value in the self_service_password__c field.

 

Here is my code that the OM is calling:

 

        ContactNotification.ContactNotification[] contacts = notifications1.Notification;
        for (int i = 0; i < contacts.Length; i++)
        {
            ContactNotification.ContactNotification notification = contacts[i];
            ContactNotification.Contact contact = (ContactNotification.Contact)notification.sObject;
            
            EnterpriseWebReference.SelfServiceUser ssu = new EnterpriseWebReference.SelfServiceUser();
            ssu.ContactId = contact.Id;
            ssu.FirstName = contact.FirstName;
            ssu.LastName = contact.LastName;
            ssu.Username = contact.Email;
            ssu.Email = contact.Email;
            ssu.TimeZoneSidKey = "America/Chicago";
            ssu.LocaleSidKey = "en_US";
            ssu.LanguageLocaleKey = "en_US";
            ssu.IsActive = true;
            ssu.IsActiveSpecified = true;
            EnterpriseWebReference.SaveResult[] saveResults = binding.create(new EnterpriseWebReference.sObject[] { ssu });
            
            for (int a = 0; a < saveResults.Length; a++)
            {
                EnterpriseWebReference.SetPasswordResult result = binding.setPassword(saveResults[a].id, contact.Self_Service_Password__c);
            }
            
            
        }
        ContactNotification.notificationsResponse response = new ContactNotification.notificationsResponse();
        response.Ack = true;
        return response;

 Any help is appreciated!

All Answers

SuperfellSuperfell

You're not checking that the call to create actually succeeds, so the id you pass to setPassword might be null, which could lead to the rather misleading error you're seeing.

mandycmandyc

Thanks, Simon. Can you give me an example of how I can check to see if the call succeeds?

mandycmandyc

Thank you, Simon.  Turns out the issue was that I was trying to insert a self service user record for a contact that was already linked to a SSU.