
20. September 2018 — Miss Ob·so·let
Microsoft Dynamics CRM: How to create company via button click (Ribbon Workbench) – Possibility No 3
In Post “Microsoft Dynamics CRM: How to create company via button click (Ribbon Workbench)“, I showed you Possibility No 1 to create a company via button click, or here for Possibility No 2.
Possibility No 1 did create a company ‘in the background’. That means that after clickin’ the button, you have to either click only the button, or you can input the account information into the prompt window(s).
With Possibility No 2, we can create the company by inputting the information directly into the form. The disadvantage here is, that some users, which are normally not allowed to create accounts are allowed to do so in other places in CRM. So I decided to switch to Possibility No 3:
I used the AccountCreator-Tool:
use the following Javascript:
function CreateVerbund() { var VerbundCreator = {}; VerbundCreator.abc_name = "BITTE ÄNDERN!!!"; VerbundCreator.abc_VerbundBesitzer = { Id: Xrm.Page.context.getUserId(), LogicalName: "systemuser" }; SDK.REST.createRecord( VerbundCreator, "abc_verbundcreator", function (VerbundCreator) { SDK.REST.retrieveRecord( VerbundCreator.abc_verbundcreatorId, "abc_verbundcreator", "abc_Verbund", null, function (result) { Xrm.Utility.openEntityForm("account", result.abc_Verbund.Id); }, function (error) { alert(error.message); } ); }, function errorHandler(error) { alert(error.message); } ); }