(function(){page.using={texts:["save_text"]};page.onLoad=function(){var t=this.url;var n=t.getUid("link"),r=t.getUid("Rec_Link"),i=null,o=t.get("mode"),a=null,c=null,u=t.get("Reciprocal");if(u!="1"){u=t.get("Reciprocal1")}if(o=="predef"){i={infoAreaId:t.get("RelationLevel")||"BL",recordId:t.get("RecID")}}else{a={relationType:t.get("type"),value:t.get("relation"),department:t.get("department")};if(u){c={relationType:t.get("rec_type"),value:t.get("rec_relation"),department:t.get("rec_department")}}}u8.request("AccountManagementChannel.CreateRelation",{request:{account1:n,account2:r,createReverseRelation:!!u,relationLevelUid:i,relation:a,reverseRelation:c}},function(t,n){var r=n.response;if(r){return page.proceed({uid:r.uid,command:"Select"})}var i=n.error;if(i.errorUid=="/update.Crm.Core/Error/1002/"){return e(i)}var o=i.type=="DatabaseAccessDeniedException"?"TXT_save_text_12":"TXT_save_text_14",a=u8.format(o,{0:u8.services.schema.idToLabl("PB")});u8.services.notification.write({severity:100,text:a});return page.proceed({infoAreaId:"PB",command:"Error"})})};function e(e){var t,n=e.properties&&e.properties.existingUid;if(n){t={message:$t("TXT_common_text_36"),onContinueClick:function(){u8.services.actions.executeDefault(n)}}}else{t={message:e.message,onContinueClick:function(){history.go(-1)}}}$("#output").utml({template:'<div>{{text TXT_common_text_36}}</div>{{Button({ textId:"TXT_button_text_6", onClick:onContinueClick })}}',data:t,itemOptions:{parent:page}})}})();