Discussions

 View Only
  • 1.  Date field to return original date of order

    Posted 10-29-2019 09:14
    I have a date field that I need to show the date an order was sent in. Right now my formula is:If([Order Status]="Approved", Today()) 
    But this returns todays date and updates each day with the current date. I need a date of when the "order" button was originally clicked and order status was changed to "approved" Is the Today function proper in this case? 


    ------------------------------
    Mike Klausing
    ------------------------------


  • 2.  RE: Date field to return original date of order

    Posted 10-29-2019 09:30
    Edited by Adam Keever 10-29-2019 09:57
    If the "order" button is in a form, this is very simple to do using dynamic form rules. There is an option to change a date field to current date from a trigger:


    You can use this in a formula rich text field if you want to use the button from table reports or in emails:
    //This is the button styling:
    "<a style=\" text-decoration: none; background: #00ff00; border: 10px solid #00ff00; border-radius: 3px; color: #000000; display: inline-block; font: normal 700 20px/1 \"Calibri\", sans-serif; text-align: center; text-shadow: none;
    
    //This is the button code for your database; be sure to add your app token
    href='"& URLRoot() & "db/" & Dbid() & "?\n\na=API_EditRecord&apptoken=XXXXXXXXXXXXXXXXXXXXXXXXXX &rid=" & URLEncode ([Record ID#])
    
    //Change 20 to your field ID for status
    & "&_fid_20=Approved"
    //Change 19 to your field ID for approval date
    & "&_fid_19="& ToText(Today())
    
    //This is a redirect to report with ID of 2; change 2 to the ID of the report you want to display
    &"&rdr=" & URLEncode(
    
    URLRoot() & "db/" & Dbid() &
            "?a=q&qid=2"
    )
    
    &
    
    "&ifv=20'>Approve</a>"

    ------------------------------
    Adam Keever
    ------------------------------



  • 3.  RE: Date field to return original date of order

    Posted 10-30-2019 14:03
    Adam,

    This seemed straight forward and would work. However when I did this I have a field called “copy to Dealers orders” that gets changed to “Sent” when the order button is selected.
    I also have a “date ordered” field that is just a date field.

    My rule says when “copy to dealers orders” is equal to Sent
    Change “date ordered” to todays date.

    When I try and click the order button no changes are made to my date ordered field however. My copy to dealers orders does say sent.




  • 4.  RE: Date field to return original date of order

    Posted 10-30-2019 15:17
    Am I correct in my understanding that you are using both a dynamic form rule and a button? What type of formula field for the button and what code are you using?

    ------------------------------
    Adam Keever
    ------------------------------



  • 5.  RE: Date field to return original date of order

    Posted 10-30-2019 23:42
    @Adam Keevers solution should give you the desired results. if you are using form rules and button, use the 'API_Editrecord' function in formula url button to update the date field value with current date. ​

    ------------------------------
    Babi Panjikar
    ------------------------------



  • 6.  RE: Date field to return original date of order

    Posted 10-31-2019 08:21
    I am using a formula URL field which is:


    var text URL = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=cpaz2k7njc4ifc24muhvc749ast&rid=" & [Record ID#]
    & "&_fid_112=Approved"
    & "&_fid_113=Yes"
    & "&_fid_874=Yes";

    "javascript:" &
    "$.get('" &
    $URL &
    "',function(){" &
    "location.reload(true);" &
    "});"
    & "void(0);”

    Where Field 113 is the field that triggers the date field when it is changed to “yes”




  • 7.  RE: Date field to return original date of order

    Posted 10-31-2019 14:00
    I am getting confused. From your two problem statements I see that your needs are as follows:

    1. Click "order" button
      1. Change order status to "Approved"
      2. Change date ordered to today's date
      3. Change "copy to Dealers orders" to sent
    Is Field ID# 874 used to trigger the "copy Dealers orders" to sent?

    You should try using the formula rich text solution and it will automatically change the date with no need for the dynamic form rule.

    There is one other thing to check for what you have in place now. Look at the bottom of the form rules page and see if toggling the fire changes box to the opposite of whatever it is now fixes your problem:


    ------------------------------
    Adam Keever
    ------------------------------