How can we help you today?

How to Map a Custom User Profile Property on Upcoming Birthdays Connected Elements

Prerequisites



Step 1: Select a ShortPoint element in ShortPoint Page Builder


You can for example select Events element or any other element you wish to display upcoming birthdays in.





Step 1: Connect ShortPoint


Select connection type

Select  REST API in connection type list



Set connection parameters

1. REST API URL


Copy the following URL, replace UserLocation with the name of the manages property to which the user property you wish to display is mapped to.

Change the maximum number of upcoming birthdays to be retrieved by setting changing 50 after &rowlimit (For example rowlimit=5 to limit upcoming birthdays to be displayed to 5)


/_api/search/query?querytext=%27*%27&selectproperties=%27AccountName,UserProfile_GUID,LastModifiedTime,OriginalPath,Path,PreferredName,ServiceApplicationID,WorkEmail,PictureURL,SipAddress,RefinableDate18,UserLocation%27&trimduplicates=true&sourceid=%27B09A7990-05EA-4AF9-81EF-EDFAB16C4E31%27&clienttype=%27ObjectModel%27&rowlimit=50&sortlist='RefinableDate18:ascending'



Paste the URL in the  REST API URL text box.


1. Set Advanced Settings 


var days = 7;
var startDate = new Date();
startDate.setHours(0, 0, 0, 0);
startDate.setYear(2000);
      
var toDate = new Date();
toDate.setDate(toDate.getDate() + days);
toDate.setHours(0, 0, 0, 0);
toDate.setYear(2000);

function formatDate(date) {
    var d = new Date(date), month = '' + (d.getMonth() + 1),day = '' + d.getDate(),year = d.getFullYear();

    if (month.length < 2) month = '0' + month;
    if (day.length < 2) day = '0' + day;

    return [year, month, day].join('-');
}
  


parameters += "&refinementfilters='and(RefinableDate18:range("+formatDate(startDate)+",max,from=\"ge\"),RefinableDate18:range(min,"+formatDate(toDate)+",to=\"le\"))'";
return parameters;


Change the number of upcoming days for which birthdays are shown:


  • To show today's upcoming birthdays change var days = 7; to var days = 0;
  • Change var days = 7;  to var days = 30; to show this month's upcoming birthdays.



Enable advanced settings and paste previous script under Change Parameters



Click Connect.




You can now see the custom property on the Content tab



Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

World's best intranet sites are designed using ShortPoint

Get started today! Learn more
See all 12 topics

Start a trial

Ignite your vision. Install ShortPoint directly on your site, or play in sandbox mode. No credit card required.

Get started today

World’s best intranet sites are designed using ShortPoint

Thousands of companies using ShortPoint everyday to design, brand and build award winning intranet sites.

Get started Learn more