Send Sharable Link Code

Questions related to customising nuBuilder Forte with JavaScript or PHP.

Send Sharable Link Code

Unread postby pmjd » Thu Sep 30, 2021 7:27 pm

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
pmjd
 
Posts: 98
Joined: Fri Mar 12, 2021 7:08 pm
nuBuilder Version: 4.5

Re: Send Sharable Link Code

Unread postby kev1n » Thu Sep 30, 2021 7:40 pm

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)
kev1n
nuBuilder Team
 
Posts: 2059
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Send Sharable Link Code

Unread postby pmjd » Thu Sep 30, 2021 7:53 pm

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: 98
Joined: Fri Mar 12, 2021 7:08 pm
nuBuilder Version: 4.5

Re: Send Sharable Link Code

Unread postby pmjd » Thu Sep 30, 2021 8:18 pm

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.
pmjd
 
Posts: 98
Joined: Fri Mar 12, 2021 7:08 pm
nuBuilder Version: 4.5

Re: Send Sharable Link Code

Unread postby kev1n » Thu Sep 30, 2021 8:38 pm

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);
Code: Select all


You will need the latest nucommon.php since I just fixed a bug.
kev1n
nuBuilder Team
 
Posts: 2059
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Send Sharable Link Code

Unread postby pmjd » Thu Sep 30, 2021 9:00 pm

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?
pmjd
 
Posts: 98
Joined: Fri Mar 12, 2021 7:08 pm
nuBuilder Version: 4.5

Re: Send Sharable Link Code

Unread postby kev1n » Thu Sep 30, 2021 10:26 pm

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.
kev1n
nuBuilder Team
 
Posts: 2059
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Send Sharable Link Code

Unread postby pmjd » Thu Sep 30, 2021 11:31 pm

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
Screenshot 2021-09-30 at 14-55-57 LotGen Beta - sendlink.png (16.01 KiB) Viewed 216 times


and the onclick code
Attachments
Screenshot 2021-09-30 at 14-56-51 LotGen Beta - mpd_history.png
Screenshot 2021-09-30 at 14-56-51 LotGen Beta - mpd_history.png (10.07 KiB) Viewed 216 times
pmjd
 
Posts: 98
Joined: Fri Mar 12, 2021 7:08 pm
nuBuilder Version: 4.5

Re: Send Sharable Link Code

Unread postby kev1n » Thu Sep 30, 2021 11:33 pm

Does that mean it works?
kev1n
nuBuilder Team
 
Posts: 2059
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Send Sharable Link Code

Unread postby pmjd » Fri Oct 01, 2021 2:00 am

Sorry afraid not, I meant a test email sent from the nuBuilder email setup screen sends successfully but the sharable link doesn't work.
pmjd
 
Posts: 98
Joined: Fri Mar 12, 2021 7:08 pm
nuBuilder Version: 4.5

Next

Return to Custom Code

Who is online

Users browsing this forum: No registered users and 5 guests