To Add OOTB Taxonomy Picker
Edit the masterpage and add:
<SharePoint:ScriptLink ID="ScriptLink2" name="scriptforwebtaggingui.js" OnDemand="true" runat="server" Localizable="false" />
<SharePoint:ScriptLink ID="ScriptLink1" name="sp.taxonomy.js" OnDemand="true" runat="server" Localizable="false" />
In your HTML/page/script editor add
<input name="countryTaxControl" type="hidden" id="countryTaxControl">
<div id="countryTaxControlContent" class="ms-taxonomy ms-taxonomy-height ms-taxonomy-width"></div>
JS to set
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () {
SP.SOD.executeFunc('sp.taxonomy.js', 'SP.Taxonomy.TaxonomySession', init);
});
//Code to initialize the Taxonomy picker control
var tagUI = document.getElementById(taxControlContentId);
if (tagUI) {
tagUI['InputFieldId'] = taxControlInputId;
tagUI['SspId'] = sspId;
tagUI['GroupId'] = '00000000-0000-0000-0000-000000000000';
tagUI['TermSetId'] = termSetId;
tagUI['AnchorId'] = '00000000-0000-0000-0000-000000000000';
tagUI['IsMulti'] = isMulti;
tagUI['AllowFillIn'] = false;
tagUI['WidthCSS'] = 'ms-taxonomy-width';
tagUI['JavascriptOnValidation'] = "";
tagUI['Lcid'] = 1033;
tagUI['IsSpanTermSets'] = false;
tagUI['IsSpanTermStores'] = false;
tagUI['IsIgnoreFormatting'] = false;
tagUI['IsIncludeDeprecated'] = false;
tagUI['IsIncludeUnavailable'] = false;
tagUI['IsIncludeTermSetName'] = false;
tagUI['IsAddTerms'] = false;
tagUI['IsIncludePathData'] = false;
tagUI['IsUseCommaAsDelimiter'] = true;
tagUI['Disable'] = false;
tagUI['ExcludeKeyword'] = false;
tagUI['WebServiceUrl'] = _spPageContextInfo.webServerRelativeUrl + 'u002f_vti_binu002fTaxonomyInternalService.json';
tagUI['FieldName'] = fieldName;
tagUI['FieldId'] = '00000000-0000-0000-0000-000000000000';
tagUI['DisplayPickerButton'] = showPickerButton;
var _emmTaggingLoadCall;
if (_emmTaggingLoadCall == null) {
_emmTaggingLoadCall = true;
SP.SOD.executeFunc('ScriptForWebTaggingUI.js', 'Microsoft.SharePoint.Taxonomy.ScriptForWebTaggingUI.taggingLoad',
function () {
Microsoft.SharePoint.Taxonomy.ScriptForWebTaggingUI.resetEventsRegistered();
});
}
SP.SOD.executeFunc('ScriptForWebTaggingUI.js', 'Microsoft.SharePoint.Taxonomy.ScriptForWebTaggingUI.onLoad',
function () {
Microsoft.SharePoint.Taxonomy.ScriptForWebTaggingUI.onLoad(taxControlContentId);
});
}
for more information visit : http://geeks.ms/lmanez/2014/06/23/using-the-oob-taxonomy-picker-control-just-from-javascript-code-in-sharepoint-online/
And to write the user profile property using the REST, very nice blog written by Vardhamn: http://www.vrdmn.com/2016/06/sharepoint-online-write-user-profile.html
Code from that for reference:
(function ($) {
'use strict';
var requestHeaders = {
'X-RequestDigest': $("#__REQUESTDIGEST").val(),
"accept": "application/json; odata=nometadata",
"content-type": "application/json;odata=nometadata"
};
var userData = {
'accountName': "i:0#.f|membership|[email protected]",
'propertyName': 'AboutMe', //can also be used to set custom single value profile properties
'propertyValue': 'Value set from REST API!'
}
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/SP.UserProfiles.PeopleManager/SetSingleValueProfileProperty",
type: "POST",
headers: requestHeaders,
data: JSON.stringify(userData),
success: function (data) {
console.log(data)
},
error: function (jqxr, errorCode, errorThrown) {
console.log(jqxr.responseText);
}
});
})(jQuery);