This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Set Due date based on a selected option from a value List

Hello

I am creating a feedback/ complaint setup in M-Files (kind of like a ticketing system)

I wish to set a 'Resolution Due Date' Date property or the due date of an assignment based on the severity of the feedback.

I have a Value List with the following option 'High, Med, Low' that is filled out when the new Feedback is entered into M-File.

once its saved i want to it do the following

If Severity is high = Set Resolution Due Date to +1 day from Date Created (or some other date property)
If Severity is Med =Set Resolution Due Date to +2 days from Date Created (or some other date property)
If Severity is low = Resolution Due Date to +7 days from Date Created (or some other date property)


I feel i could do it in a Metadata card but get a bit confused when it comes to the dynamic Value options
it says i can use 'Date Delta Value' to add days but only when i use usecurrentdate

this in theory could work for us but i'm not sure where i'm meant to put ' usecurrentdate' option.


cheers
  • I would use a script in Automatic Value to set the Due Date. I had a similar case a while ago where we needed to set Priority based on Severity and Urgency. All three properties are lookups from value lists with 4 items in each list. The values have been created in a specific order so that we could use their ID as numeric values for calculations. The script is shown below.
    You would need to use the DateAdd function to calculate your date, but that is quite simple, see www.w3schools.com/.../func_dateadd.asp
    Option explicit
    Dim iPDUrgency : iPDUrgency = Vault.PropertyDefOperations.GetPropertyDefIDByAlias("PD.Urgency")
    Dim iPDSeverity : iPDSeverity =Vault.PropertyDefOperations.GetPropertyDefIDByAlias("PD.Severity")
    Dim iUrgency : iUrgency = PropertyValues.SearchForProperty(iPDUrgency).TypedValue.GetValueAsLookup().Item
    Dim iSeverity : iSeverity = PropertyValues.SearchForProperty(iPDSeverity).TypedValue.GetValueAsLookup().Item
    Dim i1Priority : i1Priority = iUrgency * iSeverity
    Dim i2Priority : set i2Priority = CreateObject("MFilesAPI.Lookup")
    If i1Priority
    i2Priority.item = 1
    elseif i1Priority
    i2Priority.item = 2
    elseif i1Priority
    i2Priority.item = 3
    else
    i2Priority.item = 4
    End if
    Output = i2Priority