Question

If I create an Action on an External Content Type with a URL such as this . . .

http://intranet/contracts/lists/otasks/createrenewal.aspx?CN={0}&Rep={1}&Man={2}&End={3}&CC={4}&AC={5}&SO={6}&Con={7}&ConT={8}&Ref={9}

why does it get changed to this . . .

http://intranet/contracts/_layouts/ActionRedirect.aspx?EntityNamespace=http%3A%2F%2Fintranet%2Fcontracts&EntityName=RenewalQuery&LOBSystemInstanceName=ACS&ActionName=Add%20to%20Renewal%20Tasks&ItemID=%5F%5Fbk4500130053002300130053007300020002000200020002000200020002000200020002000200020002000200

when selected from a Business Data web part item??!! (which gives an error, by the way. I think because my query is so customized)

I have done this on another entity and it puts the URL in exactly as I type it in the Add Action form of Central Admin. Can this behavior be controlled or do just I have to code the list action manually?

Was it helpful?

Solution

Actually, ActionRedirect.aspx plays an important role.

As outlined here: http://msdn.microsoft.com/en-us/library/ie/ff464423.aspx, your ECT in the BDC model contain url that you want to redirect along with set of parameters and most importantly, proper mapping of your parameter like:

<Action Name="Search on Bing" Position="1" IsOpenedInNewWindow="true"
        Url="http://www.bing.com/search?q={0}+{1},+{2},+{3}" ImageUrl="">
  <ActionParameters>
    <ActionParameter Name="StreetName" Index="0"/>
    <ActionParameter Name="City" Index="1"/>
    <ActionParameter Name="StateProvince" Index="2"/>
    <ActionParameter Name="CountryRegion" Index="3"/>
  </ActionParameters>
</Action>

When you specify a custom action in your External List for a list item, the Navigate Url would take following form as shown here http://msdn.microsoft.com/en-us/library/ie/ee558387.aspx:

~site/_layouts/ActionRedirect.aspx?ItemID={ItemId}&EntityNamespace=<EnterEntityNamespaceFromModel>&EntityName=<EntityNameFromModel>&LOBSystemInstanceName=<LobSystemInstanceNameFromModel>&ActionName=<ActionNameFromModel>

So at run time, when that action is clicked in your external list item, the system first redirects to ActionRedirect.aspx. It is this page which actually locates the definition of your action in BDC model (using ActionName query string). The page then fetches all required parameter values (StreetName, City etc in above example) and performs actual redirection by replacing the parameters with actual values.

As you can see, ActionRedirect.aspx serves a purpose especially when you want parameters fetched from your entity which is what you are trying to achieve.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top