how to oen relatinal entity with javascript?
-
2012. április 29. 16:38
there is 1:N relationship between two entity with name 'A ' AND 'B' IN my form. users should . 'from primery entity 'A' , select relatinal entity 'B' in details view
and then click on add new 'B' to open a record in relatinal entity 'B' .
i wanna my form be user firendly for this,
I wanna create a link in prim entity 'A' , that open , new record from 'B' , how can i do this work?plz help me
i should say,some of user info through mapping send to relalatinal entity 'B'
Az összes válasz
-
2012. április 29. 19:14
there is 1:N relationship between two entity with name 'A ' AND 'B' IN my form. users should . 'from primery entity 'A' , select relatinal entity 'B' in details view
and then click on add new 'B' to open a record in relatinal entity 'B' .
i wanna my form be user firendly for this,
I wanna create a link in prim entity 'A' , that open , new record from 'B' , how can i do this work?plz help me
i should say,some of user info through mapping send to relalatinal entity 'B'
- Szerkesztette: shabnam2012 2012. április 29. 19:15
- Egyesítette: Andrii ButenkoMVP, Moderator 2012. május 8. 2:56 the same question
-
2012. április 29. 19:41
there is 1:N relationship between two entity with name 'A ' AND 'B' IN my form. users should . 'from primery entity 'A' , select relatinal entity 'B' in details view
and then click on add new 'B' to open a record in relatinal entity 'B' .
i wanna my form be user firendly for this,
I wanna create a link in prim entity 'A' , that open , new record from 'B' , how can i do this work?plz help me
i should say,some of user info through mapping send to relalatinal entity 'B'
- Egyesítette: DavidJennawayMVP, Moderator 2012. április 30. 8:54 Duplicate thread
-
2012. április 29. 22:33
Hi,
You cannot do this in CRM4 the usual way.
The best way would be to go with what is out of the box and give user training the way CRM 4 works. So if you have 1:N between 'A' and 'B', then when you open a 'A' record, on left hand side, you will see link to 'B'. You will have to go to that link to open 'B' associated view and then from there add/update 'B' records.
If I am understanding correct, you need a link to 'B' from 'A' detail page (form). The option you have is IFrame. In Iframe display the 'B' records view and only those which belong to 'A'. You will have to do javascripting for it.
The other option is to include an aspx page with link to create a new 'B' record.
I hope this helps. If my response answered your question, please mark the response as an answer and also vote as helpful.
Ashish Mahajan, CRM Developer, CSG (Melbourne)
My Personal Website: http://www.ashishmahajan.com
My Blogs: http://ashishmahajancrm.blogspot.com.au and http://ashishmahajancrm.wordpress.com
My Youtube Channel: http://www.youtube.com/user/ashishmahajanmscrm
My Twitter: https://twitter.com/#!/ashishmahajan74My Linkedin: 
- Válasznak javasolta: Ashish Mahajan Australia (Architect) 2012. április 29. 22:33
-
2012. április 30. 5:03Moderátor
You have created multiple thread for the same question ??, Please don't create duplicate thread
you can open entity using javascript
refer : http://msdn.microsoft.com/en-us/library/cc150850.aspx
Mahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question. -
2012. április 30. 5:04ModerátorDuplicate Thread : http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/5cade778-77b9-46f4-b87b-e09df4c5c84b
Mahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question. -
2012. április 30. 5:29
Hi ,
once i have written following function to create a relation from JS in CRM 4.0 . You can modify this to create record :
function createRelation(party1,party2)
{
var authenticationHeader = GenerateAuthenticationHeader();
var xml = "<?xml version='1.0' encoding='utf-8'?>" +
"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"+
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+
" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+
authenticationHeader+"<soap:Body>"+
"<Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+
"<entity xsi:type='customerrelationship'>"+
"<customerid type = 'contact'>"+party1+"</customerid>"+
"<partnerid type = 'contact'>"+party2+"</partnerid>"+
"<customerroleid>F0600686-6459-DE11-A824-0003FFFF395F</customerroleid>"+
"<partnerroleid>F0600686-6459-DE11-A824-0003FFFF395F</partnerroleid>"+
"</entity>"+ "</Create>"+ "</soap:Body>"+ "</soap:Envelope>";
var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Create");
xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xHReq.setRequestHeader("Content-Length", xml.length);
xHReq.send(xml);var resultXml = xHReq.responseXML;var errorCount = resultXml.selectNodes('//error').length;
if (errorCount != 0){ var msg = resultXml.selectSingleNode('//description').nodeTypedValue; //alert(msg);
return false;}
}Alternatively, you can create a new custom page in Asp.net to create a new record. Host this page in your ISV folder and put a button on entity A. As soon as button is clicked it will open your custom page which will create a new record on Page Load and then redirects to newly created CRM record URL.
Hope this helps . Let me know if you need more help .
- Válasznak javasolta: Deepak_Gangwar 2012. május 2. 10:27
-
2012. április 30. 6:00
try this code
///Entity A is 1 to N with entity B var Aattributes = new Array(); var name = new Object(); name.SchemaName = 'name'; name.Value = "A Test Record"; Aattributes [0] = name; var customer = new Object(); customer.SchemaName = "accountid"; customer.Value = "{5896EBD5-70B4-DF11-AD34-000C29416226}"; Aattributes [1] = customer; var AentityID= CreateRecord("entityA", Aattributes); var Battributes= new Array(); var name = new Object(); name.SchemaName = 'name'; name.Value = "A Test Record"; Battributes[0] = name ; var entityA= new Object(); ExistingProduct.SchemaName = 'entityAid'; ExistingProduct.Value = AentityID; Battributes[1] = entityA; var BentityId= CreateRecord("entityB", Battributes); /////////////////////////// ///Create Record function CreateRecord(entityName, fields) { var authenticationHeader = GenerateAuthenticationHeader(); var resultArray = new Array(); var attributesList = ''; for (var i = 0; i < fields.length; i++) { attributesList += "<" + fields[i].SchemaName + ">" + fields[i].Value + "</" + fields[i].SchemaName + ">"; } var query = "<?xml version='1.0' encoding='utf-8'?>" + "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'" + " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" + " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" + authenticationHeader + "<soap:Body>" + "<Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'><entity xsi:type='" + entityName + "'>" + attributesList + "</entity></Create>" + "</soap:Body>" + "</soap:Envelope>"; // Prepare the xmlHttpObject and send the request. var xHReq = new ActiveXObject("Msxml2.XMLHTTP"); xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xHReq.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Create"); xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xHReq.setRequestHeader("Content-Length", query.length); xHReq.send(query); var resultXml = xHReq.responseXML; var newid = resultXml.selectSingleNode('//CreateResult').nodeTypedValue; return newid; }
Please don't forget to Vote and marked as answer If this post answers your question or was helpful, please click "Mark As Answer" on the post and "Mark as Helpful" Be wise
-
2012. április 30. 6:02
can you explain clearly...?
what you need
Please don't forget to Vote and marked as answer If this post answers your question or was helpful, please click "Mark As Answer" on the post and "Mark as Helpful" Be wise
-
2012. április 30. 9:45can you answer me mor clear , i wanna when create url, send a lookup an a text fild value from prim entity to another form
-
2012. április 30. 10:25Moderátor
Hey,
Follow below steps
1. Use above like to open new entity form to create record http://msdn.microsoft.com/en-us/library/cc150850.aspx
2. you can use window.opener in your child entity onload to fetch data from parent entity and set if into child entity fields at the time of create.
refer :http://msdn.microsoft.com/en-us/library/cc150863.aspx
let us know more clearly if you need anything else.
Mahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.- Válasznak javasolta: Mahender PalMVP, Moderator 2012. április 30. 10:25
- Szerkesztette: Mahender PalMVP, Moderator 2012. április 30. 10:29
-
2012. április 30. 11:23i have two field in prime entity 'A' , a lookup with name order number , and a text fild with name claim no i wanna when user click a link, open new record of another form, inside another form'B' exist this fied , with name parentorderno and parentclaim no, i wanna when open this form automaticly fill this fields , so i used this url base on your information but wasent true,
-
2012. április 30. 11:23i have two field in prime entity 'A' , a lookup with name order number , and a text fild with name claim no i wanna when user click a link, open new record of another form, inside another form'B' exist this fied , with name parentorderno and parentclaim no, i wanna when open this form automaticly fill this fields , so i used this url base on your information but wasent true,
-
2012. április 30. 11:38
Hi,
How you created the link on the primary entity(A) ? could you please share your code ?
-
2012. május 2. 10:22Hi Shabnam,
If any of the responses answered your question and you are satisfied, please mark the response as an answer and vote as helpful. This will help others to search on similar problems.
Thanks in advance.Ashish Mahajan, CRM Developer, CSG (Melbourne)
My Personal Website: http://www.ashishmahajan.com
My Blogs: http://ashishmahajancrm.blogspot.com.au and http://ashishmahajancrm.wordpress.com
My Youtube Channel: http://www.youtube.com/user/ashishmahajanmscrm
My Twitter: https://twitter.com/#!/ashishmahajan74My Linkedin: 
-
2012. május 3. 11:39
thanks for this response, at first i put this cod in, onload event on my form and use alert, for return output of function but i catch error'' object undefiend". i only change 'entityA' with prime entity name and 'entityB' with relatinal entityname . and change 'entityAid' with prime entity id ,
what other change should i do with this code.
******************************
i dont know consept of this code and what change should i do in that.
var Aattributes = new Array();
var name = new Object();
name.SchemaName = 'name';
name.Value = "A Test Record";
Aattributes [0] = name;
var customer = new Object();
customer.SchemaName = "accountid";
customer.Value = "{5896EBD5-70B4-DF11-AD34-000C29416226}";
Aattributes [1] = customer;
- Szerkesztette: shabnam2012 2012. május 3. 12:12
-
2012. május 3. 12:18
thankyou
- Szerkesztette: shabnam2012 2012. május 5. 5:36
-
2012. május 3. 19:33
i wanna ehen a user is in a form click on a button , then open new record o an entity that related ti this entity, and som record is same in two entity, and i wanna when open tjis reord, some fill automaticly fill with data in previous form.
for this i crate this url but error accured.
var cno=crmForm.all.item.Datavalue;//datavalue in 'Aentity'
var url=" crmsrv/ms/userdefined/edit.aspx?etc=237& itemname="+cno;//item is a lookupfield in 'B' entity
-
2012. május 3. 19:39
another one suggest me this cod to create new record of 'B' entity.
at first i put this cod in, onload event on my form and use alert, for return output of function but i catch error'' object undefiend". i only change 'entityA' with prime entity name and 'entityB' with relatinal entityname . and change 'entityAid' with prime entity id , i dont know what other change should do with this code
var Aattributes = new Array(); var name = new Object(); name.SchemaName = 'name'; name.Value = "A Test Record"; Aattributes [0] = name; var customer = new Object(); customer.SchemaName = "accountid"; customer.Value = "{5896EBD5-70B4-DF11-AD34-000C29416226}"; Aattributes [1] = customer; var AentityID= CreateRecord("entityA", Aattributes); var Battributes= new Array(); var name = new Object(); name.SchemaName = 'name'; name.Value = "A Test Record"; Battributes[0] = name ; var entityA= new Object(); ExistingProduct.SchemaName = 'entityAid'; ExistingProduct.Value = AentityID; Battributes[1] = entityA; var BentityId= CreateRecord("entityB", Battributes); /////////////////////////// ///Create Record function CreateRecord(entityName, fields) { var authenticationHeader = GenerateAuthenticationHeader(); var resultArray = new Array(); var attributesList = ''; for (var i = 0; i < fields.length; i++) { attributesList += "<" + fields[i].SchemaName + ">" + fields[i].Value + "</" + fields[i].SchemaName + ">"; } var query = "<?xml version='1.0' encoding='utf-8'?>" + "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'" + " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" + " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" + authenticationHeader + "<soap:Body>" + "<Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'><entity xsi:type='" + entityName + "'>" + attributesList + "</entity></Create>" + "</soap:Body>" + "</soap:Envelope>"; // Prepare the xmlHttpObject and send the request. var xHReq = new ActiveXObject("Msxml2.XMLHTTP"); xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false); xHReq.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Create"); xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xHReq.setRequestHeader("Content-Length", query.length); xHReq.send(query); var resultXml = xHReq.responseXML; var newid = resultXml.selectSingleNode('//CreateResult').nodeTypedValue; return newid; }
-
2012. május 3. 20:26
thankyou mahendepal
- Szerkesztette: shabnam2012 2012. május 5. 5:36