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

I have any ExternalContentTypes(ECT) with associations between them. One ECT is shown in an external list. I want to add a custom button on that external list ribbon. And it must change value association field in my ECT.

I can't find any examples where i may to retrieve association items for field in the list.

i.e. I want to retrieve all possible values what i can set for this association field.

share|improve this question
    
Care to elaborate, I'm not sure I understand the question? –  tarjeieo Jan 31 '13 at 9:28
    
Ok, i have a WCF service and an external list in sharepoint which displays ECT. This ECT has field, let it should be 'State'. State is ECT also. In sharepoint two ECT are bounded by associations. When edit form is shown i want add button for any available states for this item. For example this can be 'Delay', 'Finished', 'Start'. But for all item count available states may be different. So, when edit form loading, i should retrieve available association items for field state and generate ribbon buttons. –  Fobos Jan 31 '13 at 9:41
add comment

2 Answers

up vote 0 down vote accepted

I found how to do that. It may be done only use list getItem operator. Something like this:

var context = SP.ClientContext.get_current();
var list = context.get_web().get_lists().getByTitle(listName);
var task = list.getItemById(_spGetQueryParam('id'));

i.e. you must have list for retrieving association items.

share|improve this answer
add comment

I'm not aware that you can have dynamic ribbon buttons.

One possible solution is to have all possible buttons and add them to the ribbon. The buttons that are not applicable should be disabled. This can be achieved using standard SharePoint development of the ribbon. I have successfully used @omlin's great codeplex project for customizing the ribbon before, the code would typically be part of a feature receiver.

I would then add the buttons (Delay, Finished, Start) to the edit form's ribbon. Then create js method for the various ribbon buttons that triggers the enable/disabled state, e.g. DelayButtonEnabled(), FinishedButtonEnabled() and so forth. The logic here can use e.g. SPServices to query the list item and based on the item decide if the ribbon button should be enabled or not.

Finally you would have to create js methods that will run once the buttons are clicked, e.g. DelayButtonClicked(), FinishedButtonClicked().

share|improve this answer
    
I use FlyoutAnchor and populate it dynamically with all possible states. For populating i should somehow call a method in my service with itemID and retrieve an available states. Is there ways to achieve this? –  Fobos Jan 31 '13 at 10:04
    
Neat... I have not used that before. When are you populating the ribbon? Is it in the context of the item? javascript? In that case you can query the item using javascript, no? perhaps you have an example of how the flyout is populated? –  tarjeieo Jan 31 '13 at 10:07
    
When create an external list, i add a FlyoutAnchor on EditForm and set his PopulateQueryCommand. When user click on the FlyoutAnchor my PopulateQueryCommand(javascript) is called and populates control with possible states. Problem: i have item with field whose values is other ECT. In my callback i must retrieve and add buttons for each possible state. How can i retrieve an association items for current editing item. Example too large, you can read this thread sharepoint.stackexchange.com/questions/58110/… –  Fobos Jan 31 '13 at 10:20
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.