Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Thanks, Ashish. It sounds like once the ActionRedirect page fetches the data it uses the original URL definition entered with the parameters filled in which is why my other Action seemed to be bypassing the ActionRedirect. –  Toadmyster Feb 2 '12 at 17:16
    
Do you know why my input parameters are not being passed with the query? (That's where my error is coming from) I think it may be because not all of them are included in the ActionParameters definition. I've added them but I can't get the revised query to show on the Action menu. The old one is cached somehow. –  Toadmyster Feb 2 '12 at 17:20
    
It may help if you update your question with what you got in your BCS model and in custom action for external list. –  Ashish Patel Feb 2 '12 at 19:38
    
Thanks but there's no way for this to work. The SQL tables I am pulling data from require more than one key to return a unique value and since Actions only attach to the one title column it's not possible. I worked around it using XSL on the BD web part and some jQuery. I'll mark your post as Answer because you verified that Actions do not pull their parameters directly from the list or web part but through the ActionRedirect.aspx page. –  Toadmyster Feb 3 '12 at 1:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.