I am trying to retrieve All the Javascript events/libraries attached to the form of particular entity from the server side.
I am able to retrieve the all the forms of that particular entity by using query expression
QueryExpression q = new QueryExpression("systemform");
q.ColumnSet = new ColumnSet() { AllColumns = true };
q.Criteria.AddCondition(new ConditionExpression("objecttypecode", ConditionOperator.Equal, "account"));
EntityCollection ec = serviceProxy.RetrieveMultiple(q);
I just need to know the Javascript library attached to OnLoad or OnSave Events in CRM form.
Querying the formxml attribute on the form will give you what you are looking for. For e.g. to get all the attribute, event and function names on contact form:
var attributeEventsDetails =
XDocument.Parse(xrmServiceContext.SystemFormSet.FirstOrDefault(form => form.Name == "contact").FormXml)
.Descendants("event")
.Select(descendants =>
new
{
AttributeName = descendants.Attribute("attribute"),
EventName = descendants.Attribute("name"),
FunctionName =
descendants.Descendants()
.FirstOrDefault(childDesc => childDesc.Name == "Handler")
.Attribute("functionName")
});