pnduke
pnduke

Reputation: 183

Redirecting to another form in CRM 4.0 based on entity type

In CRM 4.0, how can I, upon double-clicking on a record in the view grid (when it opens in edit form), check the record's Type attribute and redirect to another entity's edit page (depending on type) by passing a shared ID attribute called Document ID?

This is what I'm trying to accomplish - I have a main entity called Transaction, but it's the abstract type and by itself it is not editable - like Activities in CRM. There are specific types of Transaction entities such as Customer Pricing - these entities ARE editable (like the entity named Fax or Email in Activities). The entity called Transaction shares a number of common attributes with its sub types, including one called Document ID. When double-clicking on a Transaction record, I need to redirect the user to the corresponding entity's edit page.

Upvotes: 0

Views: 1993

Answers (1)

glosrob
glosrob

Reputation: 6715

If I understand this correctly you could do this via some javascript that runs on the form's OnLoad event.

My understanding:

  • User clicks on 'Transaction' entity Entity form loads
  • On the screen for that entity there are two fields:
    • one field called 'Document ID' which holds the Id of the sub type
    • another field called 'Document ID Type' which holds the ObjectTypeCode of the sub type

My CRM4 is a bit hazy as I have been working with CRM2011 recently but something like this would work.

function OnLoad {
    //let's look for the type field
    var typeValue = crmForm.all.new_documentid.Value;
    var typeObjectTypeCode = crmForm.all.new_documentidtypecode.Value;
    var url = window.location.protocol + '//' + window.location.host + '/';
    url = url + 'userdefined/edit.aspx?etc=' + typeObjectTypecode + '&id=' + typeValue;

    var newWindowHandle = window.open(url);

    //optionally close this window
    window.top.close();
}

URLs to open custom entities taken from here

Upvotes: 1

Related Questions