cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cindelwood
Helper I
Helper I

Adddays update item using switch control

Hello, 

 

I'm trying to build an automated flow that updates column 'Training Due Date' using adddays expression that is conditional based on values in columns 'NEW HIRE START DATE' and 'PERIOD'.

For example:

Where 'NEW HIRE START DATE' = "4/8/2022"

IF 'PERIOD' = 'FIRST DAY', then add '0' days to 'START DATE'  > output = "4/8/2022"

If 'PERIOD' = 'FIRST WEEK', then add '7' days to 'START DATE' > output = "4/15/2022"

 

My table:

cindelwood_0-1649433742546.png

My Flow:

cindelwood_1-1649433759438.png

cindelwood_2-1649433774548.png

cindelwood_3-1649433785065.png

The issue:

cindelwood_4-1649433817504.png

 

Any help would be greatly appreciated! 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@abm 

I had a space after FIRST DAY! I got it to work now. Thanks so much for your help! 

View solution in original post

11 REPLIES 11
abm
Super User
Super User

Hi @cindelwood 

 

What's the data type of Period Value column? Is this column type Text?



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
abm
Super User
Super User

Hi @cindelwood 

 

Forgot to mention that its case sensitive. So make sure your SharePoint value all are in Capital letters?

 

If not use expression to convert to toLower() or toUpper() under your switch case.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

@AB 

Thank you for your quick response! The data type for the Period column is a lookup. This is why I'm creating the flow in the first place.

Table 1 'Customer Relations Onboarding - IAM' is pulling in values from table 2 ' Onboarding Master Catalog'. The requirement is to have governance around when certain onboarding training activities should be scheduled within the 90-day onboarding process. 'Period' is the mandated time frame in which the training should be scheduled from the new hire's start date. Because Period is a lookup column, I'm trying to find a way to 

My ultimate goal is to calculate the 'Training due date' based on new hire start date and the mandated 'Period'. Is there another way to achieve this? 

Table 1 'Customer Relations Onboarding - IAM

Column Display NameTypeInternal ID
ACTIVITY Lookup (primary)ACTIVITY
ACTIVITY SET Lookup ACTIVITY_x003a_Title_x0020__x002
DELIVERY MODELookup ACTIVITY_x003a_DELIVERY_x0020_MO
ESTIMATED DURATION (MINUTES)Lookup ACTIVITY_x003a_ESTIMATED_x0020_D
PERIODLookup ACTIVITY_x003a_PERIOD
FACILITATING DEPARTMENTLookup ACTIVITY_x003a_FACILITATING_x002
FACILITATOR(S)  1= Primary 2 = BackupLookup ACTIVITY_x003a_FACILITATOR_x0028
ASSIGNED FACILITATORPersonASSIGNEDFACILITATOR
Date CreatedDate & Time_DCDateCreated
NEW HIRE NAMEChoiceNEWHIRENAME
STATUSChoiceSTATUS
TRAINING SCHEDULED FOR Date & TimeTRAININGSCHEDULEDFOR
NEW HIRE START DATEDate & TimeNEWHIRESTARTDATE
TRAINING DUE DATE Date & TimeTRAININGDUEDATE

Table 2 'Onboarding Master Catalog version 2'

cindelwood_0-1649436867934.png

 

Hi @cindelwood 

 

Ah ok that make sense now. I will send you a screenshot of the flow.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
abm
Super User
Super User

Hi @cindelwood 

 

Looks like your mapping is correct. Could you check the run history and expand the Get Item output and check what's been returned. Could you post a screenshot?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

I wasn't sure which was best to look at so I captured 2 views:

View 1

cindelwood_0-1649695427815.png

cindelwood_1-1649695437681.png

cindelwood_2-1649695446590.png

View 2

cindelwood_3-1649695463062.pngcindelwood_4-1649695471617.pngcindelwood_5-1649695479757.png

 

 

 

 

Is my adddays correct?

addDays(triggerOutputs()['NEWHIRESTARTDATE'], 0, 'dd-MM-yyyy')

Hi @cindelwood 

 

image.png

 

Yes I can see FIRST DAY is returned but why it didn't evaluated the switch? 

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
abm
Super User
Super User

Hi @cindelwood 

 

Also make sure there are no spaces at the end of FIRST DAY under the Equals mapping.

 

image.png



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

@abm 

I had a space after FIRST DAY! I got it to work now. Thanks so much for your help! 

Hi @cindelwood 

 

Thanks for the update. I had a doubt about it hence I asked about it earlier.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,470)