Trying to creat a link through server side method with AML

Hello,

AML works in Nash.

When an user is created i want to put his identity into another identity.

This method is plugged on after add event of identity item type.

Could you tell me id i missed someting ? Should i put an apply somewhere ?

Innovator _innovator = this.getInnovator();

System.Diagnostics.Debugger.Launch();

//get id of the identity of the user created

var New_identity = this.getID();

Item New_identity_item = this.newItem("Identity","get");
New_identity_item.setProperty("id",New_identity);
New_identity_item = New_identity_item.apply();

var Is_Alias_1 = New_identity_item.getProperty("is_alias");
if ("1".Equals(Is_Alias_1))

{

//3007DCA0B6B949A0A0B5E51AF85A6B52 ***_Checker

string aml = string.Format(
@"
<AML>
<Item type = 'Member' action ='add'>
<source_id>3007DCA0B6B949A0A0B5E51AF85A6B52</source_id>
<related_id>{0}</related_id>
</Item>
</AML>",New_identity);

}

System.Diagnostics.Debugger.Break();

return this;

Thanks you Slight smile

Parents
  • Hello,

    You already pointed out the problem here. :) You should just need to apply the query that you built using something like the sample code below. I've also included some simple validation to make sure the Member is actually created.

    // the aml variable is built above
    Item res = _innovator.applyAML(aml);
    if (res.isError()) {
        // If we're unable to create the Member, return the error so we can see why
        return res;
    }

    Chris


    Christopher Gillis

    Aras Labs Software Engineer

Reply
  • Hello,

    You already pointed out the problem here. :) You should just need to apply the query that you built using something like the sample code below. I've also included some simple validation to make sure the Member is actually created.

    // the aml variable is built above
    Item res = _innovator.applyAML(aml);
    if (res.isError()) {
        // If we're unable to create the Member, return the error so we can see why
        return res;
    }

    Chris


    Christopher Gillis

    Aras Labs Software Engineer

Children
No Data