Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Send Sharable Link Code

Questions related to customising nuBuilder Forte with JavaScript or PHP.
pmjd
Posts: 132
Joined: Fri Mar 12, 2021 10:38 am
Has thanked: 3 times
Been thanked: 1 time

Send Sharable Link Code

Unread post by pmjd »

Hello,

I've been looking at the Code Library to try and implement the Get a Sharable Link to Record code.
https://github.com/nuBuilder/nuBuilder- ... _of_record

Anyone know how this works and can be implimented as a button on a record? I've tried pasting it into the custom form code but just not sure what else it needs to get it working.

The most recent version looks very different to the previous versions.

Thanks,
Paul
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Send Sharable Link Code

Unread post by kev1n »

Paul, as it's a PHP code, you can create a procedure an run it with

Code: Select all

nuRunPHPHidden('your_procedure_code_here',0)
pmjd
Posts: 132
Joined: Fri Mar 12, 2021 10:38 am
Has thanked: 3 times
Been thanked: 1 time

Re: Send Sharable Link Code

Unread post by pmjd »

Thanks kev1n but not too sure on the requirements for it?

Code: Select all

// 1. Argument ($origin): Leaving it blank, nuGetHttpOrigin() will be used to retrieve the domain (HTTP_ORIGIN or HTTP_REFERER or REMOTE_ADDR)
// 2. Argument ($subFolder): Leave blank if index.php is in the root.
$recordURL = nuGetRecordURL('', '', 'nuuserhome'); 

$r = nuSendEmail('to@test.com', 'from@test.com', 'From Name', 'Body' . $recordURL, 'Subject', [], true, '', '');
It's not clear what the two arguments are and what you need to do with them. Also does this result in a popup so you can set the recipient, message etc?
pmjd
Posts: 132
Joined: Fri Mar 12, 2021 10:38 am
Has thanked: 3 times
Been thanked: 1 time

Re: Send Sharable Link Code

Unread post by pmjd »

Should have said I tried the code in a procedure as is but nothing happens.

My nuBuilder currently runs on http://localhost/nubuilder, so not in the root as such. I've tried putting both

Code: Select all

nubuilder
and

Code: Select all

/nubuilder
in the second empty ' ' but doesn't seem to have any effect.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Send Sharable Link Code

Unread post by kev1n »

The procedure's PHP code should look like this:

Code: Select all

$recordURL = nuGetRecordURL('', 'nubuilder', 'nuuserhome');
$r = nuSendEmail('to@test.com', 'from@test.com', 'From Name', 'Body' . $recordURL, 'Subject', [], true, '', '');
E.g. with the procedure code sendlink

To run the procedure (e.g. add to a button's onlick event):

nuRunPHPHidden('sendlink',0); You will need the latest nucommon.php since I just fixed a bug.
pmjd
Posts: 132
Joined: Fri Mar 12, 2021 10:38 am
Has thanked: 3 times
Been thanked: 1 time

Re: Send Sharable Link Code

Unread post by pmjd »

Thanks kev1n, I've updated the system but still no luck.

I've tried the code you posted but onclick does nothing.

Just to check that I've not misread/misunderstood but this code is meant to send an email with a link to a record from that record?
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Send Sharable Link Code

Unread post by kev1n »

pmjd wrote:Just to check that I've not misread/misunderstood but this code is meant to send an email with a link to a record from that record?
Yes, exactly. I just tested the code and it works fine for me. I suppose you have entered the email config details under Setup -> Email Settings.
Can you show screenshots of your onclick event code + PHP procedure code? You can mask private data of course.
pmjd
Posts: 132
Joined: Fri Mar 12, 2021 10:38 am
Has thanked: 3 times
Been thanked: 1 time

Re: Send Sharable Link Code

Unread post by pmjd »

Have checked and a test email is sent from nuBuilder and received.

The procedure code is
Screenshot 2021-09-30 at 14-55-57 LotGen Beta - sendlink.png
and the onclick code
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Send Sharable Link Code

Unread post by kev1n »

Does that mean it works?
pmjd
Posts: 132
Joined: Fri Mar 12, 2021 10:38 am
Has thanked: 3 times
Been thanked: 1 time

Re: Send Sharable Link Code

Unread post by pmjd »

Sorry afraid not, I meant a test email sent from the nuBuilder email setup screen sends successfully but the sharable link doesn't work.
Post Reply