Setting validation based on condition on custom list

Hi,
I have a custom Image library. I have two custom columns created as part of metadata.
One is a dropdown choice column, which contains 2 values - "Free", "Paid".
I also have a datepicker column (date only). 
I would like to set a validation based on below condition:
If dropdown selected is "Paid", then date should be mandatory field.
Can this be achieved OOB or a JSLink is required.
How to achieve this?
Thanks 

Hi Vankatzeus,
You can achieve this using Javascript. In New and edit forms of your list, add a content editor webpart with the script explained below -
There is a PreSaveAction() function that you can use to do a custom validation. Before submitting any item, sharepoint first do the validation in PreSaveAction().
function PreSaveAction() {
  //Step 1 - Read the choice and date fields. 
// Step 2 - If choice is 'PAID' and 'date' field is blank { alert('Date can't be blank'); return false;} else {return true;}
In Step 1, write a script that read values from choice and date fields. You can take the script from
here and modify it just to read choice and date fields.
Cheers,
Manvir

Similar Messages

  • Setting up records management for a custom list in SharePoint 2013

    In a workflow 2013, I am planing to 'declare a record' on a custom list. I am doing this since I do not want users to be able to change the custom list once the record is submitted to workflow 2013.
    There are options in record declarations settings that I am not certain what to set like what values are appropriate in 'declaration of records can be performed by'.
    Since I am my own administrator on my test SharePoint 2013 website, would you tell me what I can do at the administrator's site level to enable the 'mark a record and/or declare a record feature? Basically I would like to know what options to set for a custom
    list so the records can not be modified once the custom list has been submitted to the workflow.

    Hi Wendy,
    There are 2 ways either in place records or records archive it will depend on your requirments.
    check this article it will guide you about how to configure each way
    https://support.office.com/en-nz/article/Implement-Records-Management-0bfe419e-eb1d-421a-becd-5be9fed1e479?ui=en-US&rs=en-NZ&ad=NZ
    To decide which one you will choose check the comparison in this link
    https://technet.microsoft.com/en-us/library/ee424394.aspx
    Kind Regards,
    John Naguib
    Senior Consultant
    John Naguib Blog
    John Naguib Twitter
    Please remember to mark this as answered if it helped you

  • Validation based on conditions in another table

    Hi All,
    I'm trying to do a before update validation based on a condition. Basically, if the value of table1.columnA is changed to Yes only save when there are no rows in table2 columnX = Yes, otherwise online error.
    I have tried expressions, boolean, etc. and can't quite get the right combination.
    I am looking at something like select Y from dual where count of T2.CX = Yes is >1 otherwise N, and generate error only when Y is returned.
    Any help is appreciated.

    Thanks for the help. I did get it working, but in a way completely opposite than I was thinking it should work.
    FYI -
    The validation is expression 1 is contained in expression 2
    expression one is the p15_task_closed
    expression two is NO
    add a condition Exists (Sql returns a row)
    then do the select from the other table where it is true!
    I guess it says look at the conditions first, if the condition is true check the validation. If the validation is TRUE then no error, if the validation is FALSE (in this case the p15_task_closed = YES) enforce the validation error.

  • Help setting validation based on route selected

    If the LC form only has one submit button, how do you set a validation on submit based on the route selected when running forms in workspace?
    For example, if users have the option to Approve or Reject a form, can you determine which route they have selected and validate fields accordingly? So that if "reject" is selected we can validate that the reject comment field was completed, and if "approve" is selected we can validate that the form was signed?  Is there some property of the submit button or process field that makes this distiction?
    Thanks for your help!

    You can use a JavaScript if-else statement on the preSubmit event of the button. Do a check to see which of the fields are populated, then perform the required action.
    You could even hide the buttons, then if the user fills in a comment in the reject field, you simply show the reject button and keep the approve button hidden. You could have a pop-up when the form opens informing the user of the document's steps / process.

  • User message entered in Validation settings does not show up in custom list form created in sharepoint designer 2010

    I have a custom list form created in SPD based on EditItem form.  I then set field validation in Validation setting and entered a user message to display when the validation did not pass.
    The validation works in the custom form but the user message never show up.
    I see a similar question posted in 2012:  
    https://social.technet.microsoft.com/Forums/en-US/cd292b50-856f-4dfa-8cfe-aeb688ee7185/validating-fields-on-a-sharepoint-2010-custom-list-form?forum=sharepointgeneralprevious 
    Is this still a known bug?   What is the easiest workaround?

    Hi ,
    From the
    above link you mentioned, have you tried using the code line in your custom form?
    Please try the code suggested by sp-achiever and hamish, and see if it could help solve the issue.
    <SharePoint:ItemValidationFailedMessage ControlMode="New" runat="server" ID="checkform" />
    Have you installed hotfix KB245789 or CU contained this kb?
    Please check if KB245789 has fixed this issue as KP2011 suggested in the same post, and please try it in a test environment firstly.
    http://support.microsoft.com/kb/2405789
    Thanks,
    Daniel Yang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you havefeedback for TechNet Subscriber Support, contact [email protected] 
    Daniel Yang
    TechNet Community Support

  • Validations based on Listing

    Hi Experts,
    We are developing a custom program to upload the Lower and Capacity values for the SKU's in a custom table for every store.
    While uploading the data, we want to put a validation based on the Listing, so that we can put a check while updating the table.
    The reason being, if a particular SKU is not listed for a Store, then we don't want that SKU be updated in the table ( for reduced table value maintenance).
    We are using Listing procedure B3 by default for all SKU's in the article master.
    But I am not sure, how to put a validation check here.
    Could you please help me in this scenario?
    Regards
    Nainar

    Hi Nainar,
    please have a look at function module WLK1_CHECK to integrate that in your custom program. But logic can a little bit difficult as listing conditions are time-dependent (e.g. no longer valid or valid in the future). So you have to decide how to react in which case.
    From your description, it is not clear how often you want to upload your data and how often listing changes occur, etc.
    Hope it helps.
    Regards
    Tobias

  • Showing the custom train stop as default activity based on condition

    Hi Folks,
    I'm using JDeveloper version 11.1.1.5.0. I have requirement where in i have to show the custom train stop as default train stop based on some business logic instead of default activity mentioned as part of task flow with train.
    Test Case:
    I have a dynamic region where i'm loading diff task flows based on condition. Let us consider i have two task flows TF1, TF2 and One of these task flows (TF2) contains a train.
    TF2 task flows has a train with train stops as ts1, ts2 and ts3 and ts1 has been configured as default activity in TF2 task flow
    I'm loading these task flows into dynamic region based on my business logic. Currently i'm in TF1 and i'm doing some action in TF1 page. Based on my business logic in one of the button actions in TF1, i have to load TF2 into region and have to set either ts1, ts2 or ts3 as default activity. its not like every time only configured default activity as part of TF2 is shown.
    Consider this case. in IF1 i have 3 buttons b1, b2 and b3. When i click on b1, i have to load TF2 into region and ts1 as default activity. Like wise if i click on b2 in TF1, i have to load TF2 abd ts2 as default activity. Like wise if i click on b3 in TF1, i have to load TF2 abd ts3 as default activity.
    I have summarized my test case here. Its not exactly 100% same but it more or less like based on some business logic in TF1 i have to load TF2 with specific train stop as default activity.
    Please help me in this regard. Is this possible in ADF? if yes provide some pointers.
    NOTE:
    I'm able to show the specific trainstop as the selected one but its content is not showing. Though i'm able to see my intended trainstop selected but content is always the content related to the default activity configured as part of task flow.
    I have used below code to acheive ( setting atleast intended train stop as the selected on)
    TrainModel trainModel = TrainUtils.findCurrentTrainModel();
    trainModel.setCurrentTrainStop(activityId);
    [activity id i'm getting from model it self like java.util.Map<ActivityId, TrainStopModel> mapTrainStops = trainModel.getTrainStops(); and intended activityId is provided}
    // note end
    Thanks,
    Mahipal

    Hi Jobinesh,
    Thanks for your reply.
    When i try to do the navigation with in the task flow i.e. with in the train task flow, i'm able to navigate fine. But for different taskflow, i'm unable to do it.
    for ex: in my case i have three train stops ts1, ts2 and ts3. I have placed a button in ts3 and i'm returning the respective navigation el expression to navigate to either ts1 or ts2 in action method of this button. I'm able to do this successfully. but when i come from different taskflow, i'm unable to do this.
    I have tried this link as a workaround but it is not working.
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/97-deferred-trainstop-navigation-1528557.pdf
    i have tried this way, but it is not working.
    FacesContext fctx = FacesContext.getCurrentInstance();
    ExpressionFactory expressionFactory =
    fctx.getApplication().getExpressionFactory();
    ELContext elctx = fctx.getELContext();
    MethodExpression methodExpression =
    expressionFactory.createMethodExpression(elctx,
    "_adfcActivityRequest./WEB-INF/task-flow-definition.xml#task-flow-definition@*ts3*",
    String.class,
    new Class[] { });
    *//NOTE: ts3 is the activity id of third train stop*
    //queue action in region
    myspaceRegion.queueActionEventInRegion(methodExpression,
    null, null, false,
    0, 0,
    PhaseId.INVOKE_APPLICATION);
    Please let me know any pointers for this problem. is there any example with routers navigation rules which can be called from another task flow.
    Thanks,
    Mahipal

  • How to Retreive data from custom list on specify conditions?

    Hi All,
    I have custom list.And the custom list data contains 100 rows of data.
    my requirement is  how to retrieve custom list data from specific condition like 20-30,50-70.
    Assume that i want to fetch 20 record to 30th record.
    How to use the caml query for the above situation.
    Please assist me.
    Rama

    Hi 
    Thanks for posting your issue, Kindly browse the below mentioned URL to find related the CAML query example
    http://karinebosch.wordpress.com/2012/02/03/caml-and-the-client-object-model/
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • I have a sharepoint custom list with Title and image attachments, now i want to display image attachments in div based on the title.

    hi,
    i have a sharepoint custom list with Title and image attachments, now i want to display image attachments in div based on the title.

    i am using the below code only
     SPSite mySite = new SPSite("http://sharepoinsiteaddress");
    SPWeb myweb = mySite.OpenWeb();   
    SPList myList = myweb.Lists["Announcements"];   
    SPListItem myListItem = myList.GetItemById(1);   foreach (String attachmentname in myListItem.Attachments)
    String attachmentAbsoluteURL =    myListItem.Attachments.UrlPrefix // gets the containing directory URL
       + attachmentname;
       // To get the SPSile reference to the attachment just use this code
      SPFile attachmentFile = myweb.GetFile(attachmentAbsoluteURL);
       // To read the file content simply use this code
       Stream stream = attachmentFile.OpenBinaryStream();    StreamReader reader = new StreamReader(stream);
       String fileContent = reader.ReadToEnd();
    here i am using panel, how can i attach this attached image to panel

  • Can we restrict Customer list filter based on Sales Employee

    Dear All,
    One of my client is having sales offices through out india with sales employees working at each locations. Client wants that whenever any sales employees access SAP business One and enter Leads in CRM, that sales employees should not be displayed other customer except the customer he has been assigned. May i know is this possible ?
    For Ex...
    I have 2 Sales person by the name Samir & Atul
    Now Samir has been allotted following customer
    --  XYZ Ltd
    --  LMN Ltd..
    Atul has been allotted following customer
    -- ABC Ltd.
    -- GHI Ltd
    Now Whenever Samir wants to enter data in CRM, he should only be displayed the customer list he has been allotted ie XYZ Ltd & LMN Ltd.... and not other sales person customer. Is this possible ? If yes then how ?

    Possible but would have to be done through Custom Code (SDK)
    Suda

  • Implementing Alerts for a Custom List

    Hi,
    I have a custom list in our SharePoint 2013 environment. One of the columns is "Contract Expiry Date". We would like to send an automated email to a specific person when the "Contract Expiry Date" is 30 days ahead of time.
    I believe there are few ways to implement this in SharePoint.  Could you please give me your opinion about how you would implement the above requirement.
    Thanks  a lot.
    Dineth

    Hi Dineth,
    Thanks for posting your issue, Workflows seem like the right way to do it. you can customize your workflow condition based on your expiry date.
    Kindly browse the below mentioned URLs to create workflow to send an email for expiry
    http://mysharepointchronicles.wordpress.com/2012/11/05/sharepoint-list-with-workflow-email-reminder-set-to-send-30-days-from-created-date/
    http://markeev.com/Articles/item-expiration-reminders-in-sharepoint-using-workflow.aspx
    I hope this is helpful to you, mark it as Helpful.
    If this works, Please mark it as Answered.
    Regards,
    Dharmendra Singh (MCPD-EA | MCTS)
    Blog : http://sharepoint-community.net/profile/DharmendraSingh

  • 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

  • FlexField Validation based on Form Status

    Hi ,
    Background :
    I have a Valueset attahced to a segment in DFF, that say, stores a employee ID. My Value set picks up only active employees based on a specific condition. So that, when user enters data, he/she can choose only active ones.
    But as days pass by, the users are end dated. So when I query the Order ( to which this DFF is attached, ) that has an end-dated employee attached to it, the validation fails.
    My Question :
    Is there a way to have the Value set fire only in the Entry Mode and not fre in Query mode?
    Do we have to do this using the FORM.STATUS ( 'NEW','CHANGED') in the valueset query to acheive this? Or is there a simpler way?
    Thanks
    konnektme

    Hi Karthik,
    Instead of making the value set not to validate, you can make the value set to validate as successful. This can be achieved in any of the following ways.
    1) Make the Employee value set to display both Active/Inactive employees. If required the Status column can be displayed in the LOV. Also the list can be ordered by active employees first, then followed by inactive employees. There by user have the option to select the exployees be referring the employee status. This provides a provision to create records based on inactive employees also. If we strictly want to restirct to select only active employees. As said earlier, we can validate in Key-Commit or When validate Record.
    2) Change the value set to return active values always and inactive values only based on condition. Say the condition is (:system.record_status <> 'QUERY' and active_flag = 'y'). In this case only active records will be retreived in the record status is not query, where as if the record status is query, inactive records will also be retreived.
    If you have any solid condition to restrict the records, you can use those instead of record status/form status.
    I would prefer to use Option 1. Which will provide a solid result all the time. Where as option 2 might cause some issues if it is based on record/form status.
    Thanks
    K.Nataraja Suthan,

  • SharePoint 2013 users only see custom list and document lists that they uniquely created

    In my first SharePoint 2013 project, I want to create a view where users can only see their own files that they generated. I think I know how to create this view when the list is associated with the 'Documents; folder. However I have created several custom
    lists where I can only see these items when I am on the navigation pane to the right and the unique custom lists are listed under 'recent'.
    Let me know if you can answer any of the following questions:
    1. When on the main SharePoint website, can lists be displayed in other locations than what I just listed? If so, where would I see these other lists?
    2. I would like to include the custom lists that are located in the 'recent' navigation pane as a view that only I can use. This would be based upon userid. If this is possible,  how would you combine the lists lists in the same view? If this is not possible,
    how would you set a view just for the lists listed under the 'recent' section?
    3. The content approval solution under versioning settings of a library to restrict the documents to only ones that the user created (and also Approver rights).  Then if they create a new view they still won't see the documents that were not created by
    them. What about custom lists that are not in the documents area but are in the 'recent' area? Would this restrict users to see only items that they created?
    4. Item level Permissions in advance settings solve this problem for the list in the document area and the custom list in the recent area? If so, how would you setup these values?

    As it turns out the, setting Item-Level Permissions in a library is fully supported with PowerShell!
    The PowerShell commands for changing this are very simple:
    $web = Get-SPWeb http://YourSite/
    $list = $web.Lists[“Your Document Library Name”]
    $list.ReadSecurity = 2
    $list.Update()
    $web.Dispose()
    Note the 3rd line which is where you determine the value for this setting using the following values:
    1 = “Read all items”
    2 = “Read items that were created by the user”
    If you wish to modify the values for Create and Edit access instead, replace .ReadSecurity with .WriteSecurity with
    the following values:
    1 = “Create and edit All items”
    2 = “Create items and edit items that were created by the user”
    4 = “None”
    For example:
    $web = Get-SPWeb http://YourSite/
    $list = $web.Lists[“Your Document Library Name”]
    $list.WriteSecurity = 2
    $list.Update()
    $web.Dispose()
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • Adding items to custom list - performance issues - Request timed out error

    Hi,
    I am using VS 2010, c#.
    I am inserting records from an excel file, which contains 6000 records to a custom list.
    I am using the Visual webpart, and oledb connection. I am not using the openXML format, as i need to use "xls" and "xlsx" type.
    I am doing the below steps currently:
    1) From the file upload control, i am saving the excel to the sharepoint layouts - inside that a custom folder, to keep the records.
    2) Using the oledb connection to read the records and fill it in a datatable.
    3) Inserting the datatable values to a custom list.
    Looping through the datatable and inserting 3000 – 4000 records to List, I am getting the "Request timeout error".
    Below is the sample code, where i am looping the datatable and inserting the record:
    SPList prjCmpList = oWeb.Lists[strListName];
    SPListItemCollection prjCmpListItems = prjCmpList.Items;
    SPListItem prjCmpListItem;
    foreach (DataRow dr in dt.Rows)
    try
    prjCmpListItem = prjCmpListItems.Add();
    prjCmpListItem["Title"] = dr[0];
    prjCmpListItem["FirstName"] = dr[1];
    prjCmpListItem.Update();
    catch (Exception)
    I am using the "using block" for the spsite and web objects. When I see the execution time out in my web.config it is set to 3600.  But I am getting the request time out after 2 mins only.
    I have checked these link's : http://msdn.microsoft.com/en-us/library/aa973248%28v=office.12%29.aspx
    http://www.etechplanet.com/blog/how-to-import-an-excel-spreadsheet-in-sharepoint-and-save-it-as-a-custom-list.aspx
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/8664375c-fae0-483a-b43f-ce7d353b896a/importing-3000-records-to-sharepoint-list-causing-requesting-time-out-error?forum=sharepointadminlegacy
    However, I am following the best practices, and also the insertion of records is to be done programmatically.
    Has anyone faced this kind of issue? How to fix this?

    HI,
    Thanks for the reply.
    If the list has custom columns which consists of string and Date types, can the same type be used? Or should the list be an empty list without any columns?
    In the xml if it is put as "onerror= continue", how to fetch the records which error out?
    Also, in the datatable code block, which I had put in the first post, I am also trying as below:
    if(dt[1] != null)
    if(!string.IsNullorEmpty(dt[1].toString())
    prjCmpListItem["FirstName"] = dt[1].toString();
    Can these condition checks be performed with the "processbatchdata" approach?
    Thanks

Maybe you are looking for

  • Why can't I make changes on my external hard drive?

    I have an external hard drive that I set up through Windows XP that I can now access through Mac OS X on my MacBook. Unfortunately, I'm not able to delete or make any changes to any of the files through the Finder. Why is that, and can it be changed?

  • Numbers Update/Problem Opening Old Spreadsheets

    I am currently running Numbers 09, Version 2.3 (554) and when I attempt to open an "old" (older then the last update) spreadsheet, I receive a notice; "You need a newer version of numbers to open this spreadsheet.  You can download the latest version

  • Newspaper format in Smartforms

    Hi All,           Could anyone plz explain me how to print the text in the main window of a smartform with a newspaper format? KK

  • Help!!. Startup trigger change 8i - 9i

    Hi. I need help with the after startup on database trigger when I migrate from 8i to 9i. I performed DML operations in this trigger so I could update my database before any DML operation was made. Now I have a 9i Oracle database and I want to do the

  • Wat is the importance of unicode check

    hi when i m creating program using se38 in attributes i found unicode check box.. can any body tells the importance of this check box.. thanks...