Grab name from iOS Contacts record?

Viewing 1 reply thread
  • Author
    Posts
  • April 20, 2021 at 2:28 PM #44222

    Fern Lim
    Participant

    Is there a way to grab only the name of the linked Contact? (I’d love to not have to manually enter a contact’s name; I’ve just been linking to a record in iOS’s Contacts.)

    With my almost nonexistent knowledge of scripting, I’ve only gotten it to return the entirety of the iOS record, i.e.{ id = “blablabla”; name = “blablabla”; phoneNumbers = {home = blablabla; mobile = blablabla;};} etc

    April 20, 2021 at 2:50 PM #44223

    Daniel Leu
    Participant

    Your contact field returns just a regular javascript object. To get the name, you can use contact.name or contact["name"].

    Example:

    function Get_Contact_Name() {
    	var contact_id = 'fld-xxx';
    	var contact = record.getFieldValue(contact_id);
    	return contact["name"];
    }
    
    Get_Contact_Name();
Viewing 1 reply thread

You must be logged in to reply to this topic.