Reccuring Time Based Workflow in Salesforce - salesforce

I have a requirement where I need to update a custom field(number data-type) with number increasing every hour, I tried using time based workflow but unable to get my head around it. Can someone please help me, I am very new to Salesforce.

I think you should be able to achieve this with a Time-based workflow.
Let's assume the field you want to update is called hour counter
Create the workflow with evaluation criteria - created, and every time it's edited
Select "formula" rule criteria and in the formula enter ISCHANGED(hour_counter__c) || ISNEW()
Save the rule and click on Add Time Trigger
Set it to be executed after 1 hour of Rule Trigger Date
In the "Add Workflow Action" section you can add a field update with formula IF( ISBLANK(hour_counter__c) , 1, hour_counter__c + 1) (if you're using a defualt value for the field, you don't have to add the ISBLANK check, you can simply use hour_counter__c + 1 in the formula). NOTE: Ensure that the Re-evaluate Workflow Rules after Field Change checkbox on the field update is selected.
Hit save, create new record and test the values.
P.S. : I have not done anything like this but logically it seems that it should work.

Related

Chart showing a comparison after checking a checkbox

I'm trying to figure out how to connect checkbox with chart.
What I need to do is the following:
I have a chart showing two lines (two sets of data, lets name them A and B).
After checking a checkbox "compare A with previous period" or "compare B with previous period" those data disappear and instead of them a suitable comparison is shown.
I know that it is possible to make checkbox dependent chart like here:
https://datastudio.google.com/reporting/23a0d8ac-96c0-42cc-a991-5a21bc7c9962/page/VvbsB?s=rw4uzVA5G9Y
but I don't know how to do it.
I tried looking for the solution on the Internet, but nothing found.
Thank you for your help in advance.
A step by step introduction how to blend data and add checkboxes to show/hide graphs. Also how to do a calculation across datafields in different datasets, which were blended.
Add to the dataset a checkbox with the name compare_a_with_previous_period the field 3days average on/off with
case when compare_a_with_previous_period then 3days average else null end
Depending on the checkbox data is shown in that field or not (null). For blending/joining the data over different dates, a timeshift has to be done. Therefore, create a field date_old with
datetime_add(Date,interval 30 day)
Create an parameter show_differences with range 0 to 1 and add a field show_differences with
case when show_differences = 0 then 0 else 1 end
This will later be used to switch on/off the graph for the difference calculation.
Blend the data with itself using date and date_old as join and range. And rename the 3 day average to 3 days_old
Add the chart and click on the "add metric"
and enter
case when show_differences > 0 then 3days average - 3days_old else null end
to do a calculation between the bend datasets. Under Style set the missing data to "Line Breaks".

Lightning Flow Builder - compare a date field to $Flow.CurrentDate

I'm looking for a way to set a condition requirement that a specific date field will be equal to today's date, or yesterday's.
How do I do it?
Add a new formula resource of type Date and name it yesterday (or whatever) and put that code in there.
{!$Flow.CurrentDate} - 1
Edit: I am not sure if you are doing something differently but here is a screenshot of a Get Records flow element filtering based on a formula value:
And to be perfectly clear, here is a screenshot of that formula definition:

SSRS - Next/Previous Record Button Based on Date

I have a report in SSRS that shows various tablixes based on a date parameter. The user will select a date and the report will populate based on that date. This works fine. However, I would also like the user to be able to click on a "next record" button (and a "previous record" button) and the parameter (and report) will change based on the next date in the database.
The way I would normally accomplish this is by creating a text box with an action. For example, I would create a text box "Next Record", go into text box properties > Action > Go to report >, and send a new parameter that normally would be something like Parameters!survey_id.Value + 1. This works well if I want to increment the numeric ID by a static number (ie, increment by 1). I assume it works for dates too if I want to increment the day by 1 day; but how do I do this if the next record is not one day?
One way I thought would work is to create a row_number field in the dataset that provides the values to the parameter. Here is the code:
select distinct sm.survey_date
,row_number() Over (order by survey_date) as increment
from survey_main as sm
group by sm.survey_date --sometimes there are multiple surveys in one day
order by sm.survey_date desc
which gives the results
survey_date increment
2019-09-16 194
2019-08-24 193
2019-01-14 192
My thought was I could use the increment field in the text box action to find the next survey_date, but I cannot figure out the code (or if it's possible).
Is there a way to make that work? Are there any other suggestions or workaround that you can think of?
Thank you!
There are a few ways to do this, but this is the way I would approach it.
If the reports dataset was something like (this could be refactored but it easier to digest like this)
DECLARE #nextDate date
SELECT #nextDate = MIN(sm.survey_date)
FROM survey_main sm
WHERE sm.survey_date >= #reportParameterDate -- this is the date passed in from the report
SELECT *
FROM survey_main sm
WHERE sm.survey_date = #nextDate
So, first time you run the report, if you passed in 2019-08-24 then you would get data for that date, if you passed in 2019-08-25 you would get data for 2019-09-16
Then on the action for the textbox "button" the date parameter would be and expression something like
=DATEADD("d", 1, FIRST(Fields.survey_date.Value, "myDatasetName"))
This will add 1 to the survey_date that is in the dataset (these should all be the same, hence FIRST() will be fine to use).
Going back to the first run, we set the parameter as normal to 2019-08-24 and get data for that date, now when we click the 'Next Record' button it will take the FIRST survey_date (which will be 2019-08-24) and add 1 day to it and pass it to the report via the action. So we will be passing 201-08-25. The reports dataset will get the MIN survey_date that is >= the date we passed in, in this case 2019-08-25, and return 2019-09-16 which we stick in #nextDate which subsequently filters the data returned.
Hope that makes sense.

Crystal Reports- use other records for condition?

I am somewhat new to crystal reports and the syntax involved, and cannot seem to find the specifics by searching.
The problem is,
I need to check a condition of another record (linked as in image) for when Op No=10 in table Route, I must then check the Date Complete of this record in table WO Route Schedule for the same OP (see image for how they are linked) with a date input by user when the report is ran.
Table links
The jist is, im trying to show the font of a field in red when Date Complete>=FDate (user) (FOR OP 10), but since the actual list i am generating is of OPs that are not 10, I cannot seem to point crystal to look for when Op No=10, which is linked to the current OP by Route_ID and Work Order_ID! I have been trying many If statements, as well as using a case statement for when Op_No=10, but to no avail.
As a novice, I am not entirely sure of what other information is needed. Hopefully the images help explain my motive, but please ask for more info if you think this problem can be solved.
Regards
EDIT: More context if it helps (first comment)
Yeah it's hard to explain without overdoing the details, but each work order (WO) has around 100 operations (OPs). Now, crystal reports generates a list of OPs which are still active on the shop floor, but firstly it must check if a certain OP has been completed FOR THAT work order, which then produces a field with red font for when OP number 10 is completed. Now, if I was to simply put If {WO_Route_Schedule.Date_Complete}>={?FDate} , it would use the current OPs complete date, not OP No 10 for that Work order!
ok try below solution:
Place below condition in record selection formula .
{WO_Route_Schedule.Date_Complete}>={?FDate}
to find record selection formula go to File--> selectin formula ---> record
Place the op field OP No in detail section,
Now right click the op no field go to Format field ---> Tab Font ---> formula editor of color
write below condition there
if Op No=10
then crRed
else crBlack
Let me know how it goes

Modify Time Utility Component in WebRatio

I am new to using WebRatio and IFML. I need to build a small web application where at a certain point it is necessary to do some validation based on the timestamp a user provides. This timestamp should be between the range of minimum 24hours from now and maximum 14 days.
I hoped to find a way to adapt the values passed from a Time Utility component, add 24 hours or 14 days to it and then use a Compare Validation Rule to validate what the user has entered.
Can someone please explain how I can accomplish my goal here?
the best way to make this validation is to model in the form two hidden fields containing the minimum and maximum value allowed for the timestamp. In this way you can model on the timestamp field two Compare Validation Rules. Each Compare Validation Rule uses the Value Field property filled in with one of the hidden field. So, at the end, the validations on the field express these conditions
timestamp field greater than minimum timestamp
timestamp field lower than maximum timestamp
To fill the hidden fields with the correct value, given the current timestamp, you can use the Dates Function component. You can download it from the WebRatio Addons

Resources