Ribbon Button activating when a field in the Document / List item metadata = 'Yes'

Im hoping this is an easy answer as Im sure it must be, but my mind has gone blank!
Basically I have created a button to run some javascript code to fire a custom (manual) workflow on an item that is selected in a Document Library (or List)
I have set the ribbon button to only be active IF one item is selected in the Library but what I want now is to only activate the ribbon button if one item is selected AND IF a specific field in the item = 'Yes' (The field in this case being called 'DraftDoc'
[Choice field]).
Ive tried a few methods but none seem to work and VS2012 errors on debugging.
My code to enable the button so far is:
// Method to enable/disable the button on the ribbon.
function EnableSubmitDraftDocument() {
// request number of selected items.
var items = SP.ListOperation.Selection.getSelectedItems();
var count = CountDictionary(items);
// only return true is a single item is selected.
return (count == 1);
Can anyone help me with the extra code I need?
Cheers

Hi,     
According to your description, you have been able to set the ribbon button to be actived if one item is selected. Now, you want to activate the ribbon button if there is one
item selected and the value of "DraftDoc" column is "Yes".
We can achieve it by getting the value of this "DraftDoc" column of the selected item to check whether it is "Yes".
Here is a code demo about checking whether the value of "DraftDoc" column of the selected item for your reference:
function retrieveSelectedFiles()
this.clientContext = SP.ClientContext.get_current();
var web = this.clientContext.get_web();
this.selectedItem = SP.ListOperation.Selection.getSelectedItems();
this.selectedList = SP.ListOperation.Selection.getSelectedList();
if (CountDictionary(selectedItem) == 1)
this.listItem = web.get_lists().getById(this.selectedList).getItemById(this.selectedItem[0].id);
this.clientContext.load(this.listItem);
this.clientContext.executeQueryAsync(Function.createDelegate(this, onRequestSucceeded), Function.createDelegate(this, onRequestFailed));
function onRequestSucceeded() {
str = listItem.get_item('DraftDoc');
if(str == 'Yes')
str+="Yes";
alert(str);
function onRequestFailed(sender, args) {
alert('Error: ' + args.get_message());
Best regards
Patrick Liang
TechNet Community Support

Similar Messages

  • Assignment field in the document line items

    Hi,
    I have a document where the assignment field is automatically populated with values. May i know where and how these automatic values are determined?
    I have checked the document substitution but cannot find any rules there for this field.

    Hi Raja,
    What kind of documents are these? If they are billing documents, the assignment and reference fields are copied as per the configuration done for SD document copy control. If these docuemnts are uploaded documents or coming through an extenal system, the abap program must be populating these values based on sime criteria.
    Kindly check let us know the kind of documents and how the entry happens.
    Thanks and Regards,
    Anit

  • How to add a Field to the Result List in Activity

    Hello Experts !
    We are on CRM 7.0. I want to add a field to the Result List of Activity (Component: BT126S_APPT / View: ApptSR). This field is the address of the "Employee Responsible".
    So, how can I add a field to the Result List? AET is not a relevant tool for us because we don't want to create an attribute it already exist in the BOL. We just have to enhance the result list with BOL existing attributes.
    Also, after I add the field, I will need to populate my field with Data via some method.
    Thanks in Advance to all !
    Mariano.-
    SAP.

    Hi Mariano,
    The component was missing some technical data. Implement sap notes 1226612, 1363752, and then follow the manual procedure shown below.
    u2022     Execute transaction SE11.
    u2022     Choose the Radio button "Data Type" and enter value
                  "CRMST_QUERY_R_ACT_BTIL" in the Data Type field.
    u2022     Click on "Change" button.
    u2022     Position the cursor before the Includes added to this structure. Click
                 On the "+" button to add a new attribute.
    u2022     Enter the following details in the newly added blank row.
         Component: PERSON_RESP_LIST
         Component Type: CRMT_PERSON_RESP_LIST.
    u2022     Save the changes and activate the structure.
    u2022     Add the "Employee Responsible" field to the View configuration.
    u2022     Open the BSP application BT126S_APPT.
    u2022     Double-click on the view BT126S_APPT/ApptSR in the left side panel.
    u2022     Choose tab "Configuration" in right side panel.
    u2022     Choose the right configuration by using the "Choose Configuration" button.
    u2022     Click on the Edit button.
    u2022     Add the "Employee Responsible" attribute from the "Available fields" list to "Displayed fields" list.
    u2022     Save the changes
    Regards
    Krishna

  • Hello I shut my iMac down to move it to the next room when I plug it back into the wall, hit the power button nothing happens. I tried holding the power button nothing when't back to the first room plug it in where it was 2 mins ago nothing?

    Hello I shut my iMac down to move it to the next room when I plug it back into the wall, hit the power button nothing happens. I tried holding the power button nothing when't back to the first room plug it in where it was 2 mins ago nothing?

    Do you know which iMac model family you have? There are four families dating back to 1998. Troubleshooting depends on that. This forum covers the first three families made from 1998 to 2005. iMacs newer than that get a separate forum.
    Do you have the system disks that came with the computer? If so, and depending on model, you may be able to start from the CD/DVD and then make the jump to booting normally.
    All computers has a little battery on the logic board that holds date, time, and some important startup parameters when the compuer is taken off wall power for a short time. If your battery was very old and died, then the settings the computer needs to start may have been lost when you unplugged it. For some Mac modles, booting from a CD or DVD gets around this temporarily, but ultimately the battery needs to be replaced. The internal batteries are cheap but can be hard to access on some iMacs like the G4 "desklamp" model

  • While trying to restore os x and erase content, some problem about voice software came up and the computer asked me to restart and try again by clicking restart button. When I did this, the machine went to a gray start up screen and will not progress.

    While trying to restore os x and erase content on my MacBook pro, some problem about voice software came up and the computer asked me to restart and try again by clicking restart button. When I did this, the machine went to a gray start up screen with an apple and will not progress. I've waited more than 30 minutes and tried restarting again by holding the power button. Also, restore cd 1 will not eject so the computer will no longer move past the gray screen with spinning circle. Restore CDs had never beeused and were still in packaging in the original box. Ran hardware test just to check, and it came back as normal. Now what? I live nowhere near a genius bar :(

    computer asked me to restart and try again by clicking restart button.
    That's called a kernel panic...
    Since the install disc won't eject, try starting up while holding down the C key. If the Mac won't boot while holding down the C key, try ejecting disc by either holding down the mouse while starting up or holding down the Eject key while starting up.
    Try booting from your install disc so you can run Disk Utility in case the startup disk needs repairing.
    Insert your install disk and Restart, holding down the "C" key until grey Apple appears.
    Go to Installer menu and launch Disk Utility.
    (In Mac OS X 10.4 or later, you must select your language first from the installer menu)
    Select your HDD (manufacturer ID) in the left panel.
    Select First Aid in the Main panel.
    (Check S.M.A.R.T Status of HDD at the bottom of right panel. It should say: Verified)
    Click Repair Disk on the bottom right.
    If DU reports disk does not need repairs quit DU and restart.
    If DU reports errors Repair again and again until DU reports disk is repaired.
    When you are finished with DU, from the Menu Bar, select Utilities/Startup Manager.
    Select your startup disk and click Restart
    While you have the Disk Utility window open, look at the bottom of the window. Where you see Capacity and Available. Make sure there is always 15% free space.
    What is a kernel panic
    Mac OS X Kernel Panic FAQ
    Resolving Kernel Panics

  • Field functional area does not appear as an entry field into the document..

    Hi,
    We are using the functional area field in our system. In order to access this field, we proceeded
    to customize the system as follows:
    -  We already activate Cost of Sales Accounting for our Company Code.
    -  The field functional area was set optional through transaction OB41, for the posting keys required.
    -  The field functional area was set optional using transaction OB14, for the field status group assigned to the GL accounts.
    However, we cannot enter the area functional when we are posting documents related to customers and vendors. 
    Although the field functional area was set optional, it does not appear as an entry field into the document screen for the
    different transactions: fb70, fb60, f-02,fb01.  It is only happening when we areentering the document position for the vendor/customer.
    Regards,
    Efrain

    Hi,
    In FB70 or FB60 change the layout ........ select the line item layout configuration, you get a separate Table Settings screen pop up where in you need to select "Administrator"  button the system displays another pop up window where in you can check whether the Functional Area field is checked as invisible if so remove the check mark and active the settings.
    Kind Regards

  • I've a new account on iMac.  When composing an email the contact list does not show up on the bar.  WWhen I start keying in a name, it comes up with the address.  How do I engage the  contact list from the email?

    I've a new account on iMac.  When composing an email the contact list does not show up on the bar, which would allow me to select the persons I want to include on the distribution of the email.  When I start keying in a name in the email, it comes up with the person's address, which shows it is synced.  How do I engage the contact list from the email like I do on my old account (where a contact list icon shows up, along with the "attach" and other icons) ?

    With the New Message window open, go to the View menu and select "Customize Toolbar...".
    In the screen that opens, drag the item labelled "Address" into the Toolbar area of the New Message window, then click the "Done" button.
    That item should be then added to the Toolbar for the New Message window.
    Note that the main Mail window and the New Message window (as well as the separate message window if you open a message that way) use different toolbars - the settings/inclusions for one do not carry over to another.

  • What are all the ways that can add fields in the output list of FBL3N transaction?

    Hello dear experts,
    There is this transaction FBL3N, which you might be aware of. Now, the requirement is to add 4 new fields in the output list of the standard program.
    The fields are:
    NAME1   KNA1
    LOKKT    BSEG
    USNAM   BKPF
    TXT50      SKA1 -> SKAT
    Please tell me how to do this apart from implementing the note 310886. What are the other ways?

    I agree, start reading 984305 - Line item: Definition of special fields (T021S)
    Then for non BSEG/BKPF fields, better use BAdI FI_ITEMS_CH_DATA (1323512) and not the good old BTE 1650, the BAdI will be called once with the full internal table with special fields already filled, when the BTE will be executed for each and every record without special fields, so harder to optimize, and may require access to BKPF/BSEG for missing fields.
    Regards,
    Raymond
    PS: Did you use search tool, there are already many discussions/threads on this subject.

  • Cutom ribbon button and valid RegistrationId for an External Type List

    I'm developing a custom ribbon bar command for my particular External Content Type list. I know that for the command to be shown correctly I need a valid RegistrationId which would correspond to my list. But it seems to be unclear for me what to set there
    if I use the button against an Extarnal Content Type list because RegistrationId=101 or 100 doesn't work there .  Any suggestions?

    Hi,
    For your requirement, here are three workarounds for your reference:
    1. Use JavaScript to hide the button accordingly.
    Add custom ribbon button for this kind of list, then add a JavaScript snippet to the list views or different forms to hide that button according to the checking result
    of the list name.
    2. Create a custom list definition and create list with ribbon button based on it.
    After the site provisioned, delete the original list and create a new list with based on this list definition with similar columns.
    3. Make another site template contains this list with the custom ribbon button.
    Best regards
    Patrick Liang
    TechNet Community Support

  • Activated fonts not found in the font list.

    A constant problem - active fonts not found in the font list.
    And often when I can find trouble fonts, they're not correctly alphabetically ordered. I understand this may be the fault of the font author - not saving the correct screen name for the font so it matches it's actual name.
    Here's a strange case - Homestead. An approach to typography I've never seen before - you're meant to layer up multiple instances of the same text object and alter it's subset of the Homestead family. But activate the whole family and you'll never find more than one of it's family members at a time. Activate just one and you'll find it (not in alphabetical order, though). Deactivate that one and activate another - now you'll find it. This makes it's very cumbersome to use the font as intended. What is Aunt Illy doing here and why?
    will I ever get along with fonts . . .

    You have a font conflict on your machine. Clear your font cache, you must have another font conflicting. The whole family loads for me, and shows in Illustrator.
    There are many products to clear your cache the one below is free for mac
    http://homepage.mac.com/mdouma46/fontfinagler/
    You can also find and delete all your .lst files, or use font doctor or Font Explorer X Pro

  • Lookup field to the same list - bug in IE

    Hi!
    I have a list and lookup field refers to the same list. If I add items with the same name, then the dropdown list for this field on the new\edit form stops functioning in IE.
    Unable to get property 'split': null or undefined​ 
    core.js line 2...
    In other browser everything ok. So, it seems bug in IE.
    May be there some fix? Please advice

    Hi,
    Per my understanding, there is a lookup field in the current list which lookup a filed in the same list. When add item with same name as the previous item, new/edit
    form stop functioning in IE.
    What version of IE in use in your environment?
    I tried to reproduce this issue in IE 8+ versions, it turns out that all works without issue:
    List view page:
    NewForm page:
    Feel free to reply if there any progress.
    Thanks
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to get additional field from the second list base on lookup information column ?

    Hi everyone,
    Currently I created a SharePoint hosted Apps project and I need to know how can I get additional field from the second list base on lookup information column. example List1 Have 2 columns column1 and column2(Lookup Information from list2 (category)),
    List2 have 3 columns title, and category, and color.  so how can get the title and color from list2 base on this lookup information column (SharePoint Hosted apps and Javascript code)? that is possible?
    Best regards,
    ------------------------------------------------------------ ---Tola---

    You can build one custom lookup control. Refer to the following post
    http://www.stuartroberts.net/index.php/2012/10/03/enhanced-lookup-field-part-1/
    Alternatively, try the following solution from codeplex
    http://sp2010filteredlookup.codeplex.com/
    http://filteredlookup.codeplex.com/
    --Cheers

  • My computer wont recognize my ipod touch, when i go into the devices list (windows 7) it comes up but its under unspecified and says it needs troubleshooting. what can i do to get it to connect properly again?

    when i plug in my ipod into the right usb port it makes the connecting noise but nothing pops up and itunes does nothing. then when i look into the devices list it is under a category called unspecified and says that it needs troubleshooting. if i run the troubleshooting program it says it could not find a solution to the problem. i want to know how to fix this.

    I was struggling with this since my latest Itunes update.  Fiirst it would not recognize my IPad as a device, after correcting that, it would list the Ipad in my device but my Sync had no options (summry, info, etc). and it kept saying it was "Accessing Itunes store".  reading your question I suddently tried deleting the itunes task (alt-ctrl, delete, processes) and delete Itunes.  (By the way, I had rebooted my computer several times over the last few days).  I opened up Itunes, and voila. Device is there. No "accessing windows" and my sync has the normal options.
    ****..feels good to actually write an answer rather than writing a questions.
    Eman

  • Adding date field in the notification list-- MAM2.5

    hi
    i want to add DATE field in the notification list
    this field is already there in the device inside notification details i want to get it in the list beside notification no
    Can I do this by editing List Def.xml file in the device
    pls tell me  way to do
    with regards
    sid

    Hi Sid,
    You need not modify the xml file. You have to change the JSP file(not sure which one) for your application using the netweaver developer studio.
    Regards,
    Rahul

  • Using Windows 7 and LR 5  when I look at the Keyword List a certain keyword has 7 pictures but when I check the Library Filter with that keyword 350 pictures are shown which includes the 7 pictures that have the keyword.  Why does the Library Filter showi

    Using Windows 7 and LR 5,  when I look at the Keyword List a certain keyword has 7 pictures but when I check the Library Filter with that keyword 350 pictures are shown which includes the 7 pictures that have the keyword.  Why does the Library Filter showing pictures that do not match the query

    Dan,
    Here's what's going on in the catalog you sent me, "Joel & Caitlin's Wedding".  There is the keyword "gwenn", which is explicitly assigned to 7 pics. But keyword "schwartz" has a number of synonyms, including "gwenn", and it is assigned to 25 pics.  There is no overlap between the two sets of pics. 
    I discovered these two occurrences by doing Metadata > Export Keywords, opening the exported file in an editor, and then searching for "gwenn".  I found two occurrences of "gwenn":
    gwenn
    schwartz
        {gwenn}
    From this, you can see that the keyword "schwartz" has 9 synonyms, of which "gwenn" is one.
    The filter criterion "Keywords Contain gwenn" will match the 7 pics that are explicitly assigned the keyword "gwenn", and it will also match the 25 pics assigned the keyword "schwartz", because that keyword has a synonym "gwenn".
    This illustrates the behavior I mentioned above: The criterion "Keywords contains x" will match against any of a pic's assigned keywords, any of those keywords' ancestor keywords, and any of the synonyms of the assigned keywords and their ancestors.
    So LR is operating correctly here, if not in a way that's easy to understand. 
    It appears that you are using the synonyms of "schwartz" to represent individual members of the Schwartz family.  A better way of representing family relationships is to have a parent keyword "Schwartz", with subkeywords for each family member, e.g. "Gwenn Schwartz", "Joe Schwartz", "Jane Schwartz", etc.  Repeating the family name in the subkeywords has a couple of advantages. LR usually only displays the "leaf" name of a keyword, so instead of showing you just "Joe", it will show you "Joe Schwartz", helpful when there are a number of different people whose first name is "Joe".  Also, if you ever export your pics to other software, it may not understand the LR hierarchy and won't show the parent keywords, so again it's more informative to see a keyword named "Joe Schwartz" rather than "Joe".

Maybe you are looking for

  • Variable substitution error

    Hello All, Below is my source structure: <Messages>    <Message1>        <MT_BILL>    (0...*)           <RECORD> (1....*)              <FILENAME>  (1...1) If using variable substitution for the filed FILE NAME which is in the source structure. This i

  • Getting error message when trying to add apple id to facetime and imessage, getting error message when trying to add apple id to facetime and imessage

    When I try to add my Apple ID to Facetime or iMessage, I get an error message "username or password is incorrect " even though its the same username and password I use for everything else. anyone else getting this problem?

  • Image attachments cannot be extracted by recipient

    I'm having a problem whereby when I add an image to an e-mail – and the image shows in the body of the e-mail rather than as an icon – in a number of instances the recipient (Windows users) cannot drag the image out of the e-mail. Is this a common pr

  • XML Auto page layout

    hi i want some help about xml mapping in indesign. i have xml file, but want extract some data (structure is name, statement, statement 1, address, address1, address2, city etc.) like name, statement, address1, city. So How to map this to come only t

  • Can I use an iMac as a repeater?

    I live in an old house with plaster/lathe walls, and the Airport reception is not that good. I have a Airport Snow basestation hooked up to a cable modem downstairs, and an iMac G3 with an airport card upstairs that the family uses. The problem is th