Open new window on some event

i was just trying to open new service activity window on some event  & and after that i was trying to set customers according to the parent contact id

i was just trying with

window.open(‘/activities/serviceappointment/edit.aspx’);

and i write following code to access paraent contactid look on form load event of service activity window.

// to create lookup array

var customer_lookup=new Array();

// to check for new form

if (crmForm.FormType == 1)
{
 // Check to confirm that the window.opener is present.
 if (window.opener)
 {
  // Get the values of the parent form.
  var oParentCrmForm = window.opener.document.all.crmForm;
//To check Window.opner is calim entity or not

//10000 objectTypecode for my custom entity you can query ur organization database to check your custom entity’s objectTypecode

if (oParentCrmForm && oParentCrmForm.ObjectTypeCode == 10000)
{
var customer_lookupItem= new Object();
customer_lookupItem.id=oParentCrmForm.all.asu_contactid.DataValue[0].id;
customer_lookupItem.typename=’Contact’;
customer_lookupItem.name=oParentCrmForm.all.asu_contactid.DataValue[0].name;
customer_lookup[0]=customer_lookupItem;
crmForm.all.customers.DataValue=customer_lookup;
}

}
}

but i got one confusion when i was trying to open new service activity from action menu i was getting the customers name but when i was trying to open new service activity through my custom button it was not populating …..

after some time i compare both the url Oppsssss i was missing organization name as i was working on multiorganization …….

so i changed my URL fo

window.open(‘/’+ORG_UNIQUE_NAME+‘/activities/serviceappointment/edit.aspx’);

and finally it was working ……….

🙂

Leave a Reply

Your email address will not be published. Required fields are marked *