Extract Field Value

Viewing 2 reply threads
  • Author
    Posts
  • January 13, 2023 at 6:50 PM #48637

    Mike Guilbault
    Participant

    I’m trying to extract the phone number from a linked form.
    The current form is called Appointments and the field is simply called “Phone”
    The linked form is called “INSTALLS” and the field I want to draw from is called “Best Phone”

    This is the error I get when I run the script:
    2023-01-13, 8:27:29 PM / Appointments / Phone
    Phone: SyntaxError: Invalid character ‘\u2018’, line:3

    and this is the Script:

    function Phone_Script() {
    
    	var Phone_id = ‘’fld-1a146d1f63aa43c0881af16b1e65f1be;
    	var Best_Phone = record.getFieldValue('fld-eef8580ecdb744bf94a58eb1b7997a89');
    	if (Best_Phone != undefined) {
    		var Phone = Best_Phone.getFieldValue(Phone_id);
    	
    		return Phone;
    	} else {
    		return "";
    	}
    }
    
    Phone_Script();

    Any suggestions?

    • This topic was modified 1 year, 10 months ago by Brendan.
    January 13, 2023 at 8:35 PM #48640

    Brendan
    Keymaster

    You have two quotes at the beginning of the Phone_id var. There should be one on either side of the field ID (before the semi-colon).

    Make sure you’re also not using curly quotes, which it looks like you are there. You need to use straight quotes.

    January 14, 2023 at 6:59 AM #48643

    Mike Guilbault
    Participant

    Argh… don’t you just hate when it’s something simple like that! lol

    anyway… fixed that, straight quotes… now getting nothing, no phone number and the console log is: 2023-01-14, 8:53:14 AM / Appointments / Phone

    I think the problem is in my choice of field names, Phone and Best_Phone. Should I have the linked Form name in there somewhere?

Viewing 2 reply threads

You must be logged in to reply to this topic.