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:

0102

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);

}

);

}

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About Miss Ob·so·let

Imperfection is beauty, madness is genious. it is better to be absolutely ridiculous than absolutely boring.

Category

nice to know

Tags

, , , , , ,