Legacy Dev Forum Posts

 View Only

Sign Up

getContactByPhoneNumber Action returning null

  • 1.  getContactByPhoneNumber Action returning null

    Posted 06-05-2025 18:47

    Duncan_Stewart | 2017-10-18 19:22:38 UTC | #1

    I've been running Call tests on my Salesforce Integration IVR and running into an interesting(?) problem. I added my cell number as the Salesforce Contact.Phone, and built my custom webservice leveraging the Salesforce Contact.Id returned from the PureCloud getContactByPhoneNumber Action.

    I sketched out a basic flow that calls getContactByPhoneNumber, passing the Task.ContactId to my custom Action. <img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/6669e1fdb8623bb4a6cabc3d7a0ae5b52b5a6bb9.png" width="690" height="185">

    I'm still building out the call flow, but I was not seeing any results from my webservice, or rather, all of the result values were empty/null. Is there any way to get a look at the query behind getContactByPhoneNumber? I thought that the query/service must function like the PureCloud Call Center does, which will pull up the Contact, but apparently not, as there do not appear to be any values coming back.


    anon47876146 | 2017-10-18 20:03:50 UTC | #2

    You said you are passing the Task.ContactId to the action? Is that correct? I think you should be passing the phone number to the action based on the name of your action?


    Duncan_Stewart | 2017-10-18 20:23:53 UTC | #3

    getContactByPhoneNumber is the PureCloud Action; I'm passing Call.Ani to that one. Get Patient Delivery Details III (now) is where I'm hoping to use Task.ContactId from getContactByPhoneNumber.


    Duncan_Stewart | 2017-10-18 20:24:49 UTC | #4

    By 'PureCloud Action', I mean it's one of the default Salesforce Actions built into the integration.


    anon47876146 | 2017-10-18 20:27:01 UTC | #5

    If you test the getContactByPhoneNumber action from the Integration Actions page, does it return data for the phone number you input there?


    Duncan_Stewart | 2017-10-18 20:31:37 UTC | #6

    Good point -- I forgot I could bang against those as well. (Tunnel-mind, sorry.) Thanks for the quick thinking & response!

    Duncan


    Duncan_Stewart | 2017-10-18 20:40:07 UTC | #7

    'Too many results', though internal Salesforce reporting indicates only 1 contact listed w/ that phone number in Phone, HomePhone, OtherPhone, or Mobile. (There had been 2, but I cleared out the # in one of the records.)


    anon47876146 | 2017-10-18 20:46:20 UTC | #8

    Something on the Salesforce side may not be completely updated yet? We are doing a SOSL query similar to 'Find {input.PHONE_NUMBER} IN PHONE FIELDS RETURNING Contact(Id)'. You could try testing this query in the Salesforce Workbench to see if it returns more than 1 contact still.


    Duncan_Stewart | 2017-10-18 20:55:35 UTC | #9

    Good news: I was able to get the Integration Action test on GetContactByPhoneNumber to return a single record; in the flow, I'm getting the 'Failure' message on that same action, which reads out the phone number, and they appear to match.


    Duncan_Stewart | 2017-10-18 20:55:52 UTC | #10

    So, 1/2 good news...


    anon47876146 | 2017-10-18 21:10:09 UTC | #11

    I'm not so good at trying to diagnose Architect Flow errors. @Ullyot_Jim do you have any advice here? Should Duncan open a Support Case so we can get logs?


    anon47876146 | 2017-10-19 02:26:17 UTC | #12

    When you Test the getContactByPhoneNumber Action, what does the test output show for the Flatten step? does that match the Fields shown in Architect for that Task?


    Duncan_Stewart | 2017-10-19 12:55:37 UTC | #13

    The attributes listed in Architect for the action are a bit more generic, but with the exception of birthdate, created date & a few related Ids (Account, Owner) that are returned in Test, they can all be mapped. I only care about the FirstName & Contact.Id, so those are the only ones that are mapped. But for whatever reason, actually calling the flow results in a Failure outcome when called from the same number that I used in Test.

    <img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/05f06a437616a8f27959f530144238c9c948a267.png" width="690" height="387">

    Here's what's returned in the Action test (and it's all test/demo data, so no worries): { "AccountId": "0014000000Ed8iIAAR", "Email": "demoemail@demo.com", "MailingAddress.state": "Alberta", "MailingCountry": "Canada", "attributes.url": "/services/data/v37.0/sobjects/Contact/0034000001MlRFYAA3", "MailingState": "Alberta", "Name": "A D", "MailingAddress.countryCode": "CA", "OwnerId": "00540000001SPkxAAG", "Phone": "(781) 354-5262", "MailingPostalCode": "01843", "attributes.type": "Contact", "MailingAddress.city": "Lawrence", "IsDeleted": false, "FirstName": "A", "MailingCity": "Lawrence", "MailingAddress.country": "Canada", "Birthdate": "1950-04-01", "MailingAddress.stateCode": "AB", "HomePhone": "(781) 354-5262", "MailingAddress.postalCode": "01843", "CreatedDate": "2014-04-17T11:49:20.000+0000", "MailingAddress.street": "128 Canal St.", "Id": "0034000001MlRFYAA3", "LastName": "D", "Fax": "(978) 555-4591", "MailingStreet": "128 Canal St." }


    anon47876146 | 2017-10-19 13:21:26 UTC | #14

    I think the issue here is that the Action you are testing against on the Integration Actions page is different than the action you are trying to use in your Flow. In your Flow, you want to use a Call Data Action rather than a Bridge Action.


    Duncan_Stewart | 2017-10-19 17:43:50 UTC | #15

    Thanks, Trey -- that was it!

    Now I'll just build those other steps out again ... they do get easier with the repetition :smiley:

    Duncan


    system | 2017-11-19 17:43:57 UTC | #16

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 1969