web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Why my formula on the ...
Power Apps
Unanswered

Why my formula on the Form Onsuccess is raising "Runtime Error"

(0) ShareShare
ReportReport
Posted on by 3,506

I have a text box named "inpPromoID_frm" with View = DisplayMode and this Default property:-

 

"FY" & Right(
LookUp(
'Fiscal Reporting Calendar',
And(
'Beginning of Week' <= inpPromoStartDate.SelectedDate,
'End of Week' >= inpPromoStartDate.SelectedDate
),
'Fiscal Year'
),
2
) & "WK" & LookUp(
'Fiscal Reporting Calendar',
And(
'Beginning of Week' <= inpPromoStartDate.SelectedDate,
'End of Week' >= inpPromoStartDate.SelectedDate
),
Week
) & "_" & Substitute(
inpPromoName_frm.Text,
" ",
""
)

 

 

and on the form on success i have this formula:-

 

Set(varSpinner_frm,true);
If(
 varFormMode = "New",
 Set(ShowForm,false);
 ForAll(
 AttachArticlesControl.Attachments As FileUpload,
 PRFAttachments.Run(
 {
 contentBytes: FileUpload.Value,
 name: inpPromoID_frm.Text & "_" & FileUpload.Name
 },
 inpPromoID_frm.Text,
 "Articles",
 User().FullName,
 Left(
 FileUpload.Name,
 Find(
 ".",
 FileUpload.Name
 ) - 1
 ),
 frmPromotionRequests.LastSubmit.ID,
 Right(
 FileUpload.Name,
 Find(
 ".",
 FileUpload.Name
 )-2
 )
 )
 );
 ForAll(
 AttachFinancialAnalysisControl.Attachments As FileUpload,
 PRFAttachments.Run(
 {
 contentBytes: FileUpload.Value,
 name: inpPromoID_frm.Text & "_" & FileUpload.Name
 },
 inpPromoID_frm.Text,
 "Financial Analysis",
 User().FullName,
 Left(
 FileUpload.Name,
 Find(
 ".",
 FileUpload.Name
 ) - 1
 ),
 frmPromotionRequests.LastSubmit.ID,
 Right(
 FileUpload.Name,
 Find(
 ".",
 FileUpload.Name
 )-2
 )
 )
 );
 UpdateContext({varSubmitFormTimer: false});
 Reset(tmrSubmitForm);
 UpdateContext({varSubmitFormTimer: true}),
 Set(ShowForm,false);
 ForAll(
 AttachArticlesControl.Attachments As FileUpload,
 PRFAttachments.Run(
 {
 contentBytes: FileUpload.Value,
 name: inpPromoID_frm.Text & "_" & FileUpload.Name
 },
 inpPromoID_frm.Text,
 "Articles",
 User().FullName,
 Left(
 FileUpload.Name,
 Find(
 ".",
 FileUpload.Name
 ) - 1
 ),
 LookUp(
 'Promotion Requests',
 'Promo ID' = varPromoID,
 ID
 ),
 Right(
 FileUpload.Name,
 Find(
 ".",
 FileUpload.Name
 )-2
 )
 )
 );
 ForAll(
 AttachFinancialAnalysisControl.Attachments As FileUpload,
 PRFAttachments.Run(
 {
 contentBytes: FileUpload.Value,
 name: inpPromoID_frm.Text & "_" & FileUpload.Name
 },
 inpPromoID_frm.Text,
 "Financial Analysis",
 User().FullName,
 Left(
 FileUpload.Name,
 Find(
 ".",
 FileUpload.Name
 ) - 1
 ),
 LookUp(
 'Promotion Requests',
 'Promo ID' = varPromoID,
 ID
 ),
 Right(
 FileUpload.Name,
 Find(
 ".",
 FileUpload.Name
 )-2
 )
 )
 );
 Set(varSpinner_frm,false);
 Reset(AttachArticlesControl);
 Reset(AttachFinancialAnalysisControl);
 Navigate(scrPRFDetails)
)

 

but i am getting this runtime error on the above formual (the form onsuccess formula):-

 

johnjohn123_0-1680793433099.png

 

johnjohn123_1-1680793589460.png

 

 

now if i instead of writing this inside the Form onsuccess:-

 

inpPromoID_frm.Text

 

I copy the whole formula (the formula inside the text box Default property):-

 

"FY" & Right(
LookUp(
'Fiscal Reporting Calendar',
And(
'Beginning of Week' <= inpPromoStartDate.SelectedDate,
'End of Week' >= inpPromoStartDate.SelectedDate
),
'Fiscal Year'
),
2
) & "WK" & LookUp(
'Fiscal Reporting Calendar',
And(
'Beginning of Week' <= inpPromoStartDate.SelectedDate,
'End of Week' >= inpPromoStartDate.SelectedDate
),
Week
) & "_" & Substitute(
inpPromoName_frm.Text,
" ",
""
)

 

i will not get any error? any advice?

Thanks

 

 

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @johnjohn123 ,

     

    It seems that whatever you are pushing to the flow as the "text" parameter, Power Automate doesn't like. 

     

    Can you please share the below view where it shows which parameters are expected and in which order:

     

    BCBuizer_0-1680794857605.png

     

    In the above example there's only a single parameter called "HTML" which requires a text type:

     

    BCBuizer_1-1680795006144.png

     

    This information is needed to determine which part of the formula is causing the issue.

  • johnjohn123 Profile Picture
    3,506 on at

    @BCBuizer thanks for the reply and sorry for the late response, here is a screenshot of the workflow parameters:-

     

    johnjohn123_0-1680798553843.png

     

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @johnjohn123 ,

     

    Can you also post the other requested screenshot?

  • johnjohn123 Profile Picture
    3,506 on at

    @BCBuizer yes sure here it is

    johnjohn123_0-1680815340700.png

     

     

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @johnjohn123 ,

     

    Thanks. I assume inpPromoID_frm.is a text input, correct? Is that blank when you are submitting the form?

  • johnjohn123 Profile Picture
    3,506 on at

    Yes it is blank if i read it as :-inpPromoID_frm.Text

    although i have defined a Default value for this  inpPromoID text field, so why the text is not getting the default value correctly? any idea?

    @BCBuizer

     

    Again as i mentioned before, if i copy this forumla directly inside the Form OnSuccess insitead of getting the field text using inpPromoID_frm.Text, i will not get any error...

    "FY" & Right(
    LookUp(
    'Fiscal Reporting Calendar',
    And(
    'Beginning of Week' <= inpPromoStartDate.SelectedDate,
    'End of Week' >= inpPromoStartDate.SelectedDate
    ),
    'Fiscal Year'
    ),
    2
    ) & "WK" & LookUp(
    'Fiscal Reporting Calendar',
    And(
    'Beginning of Week' <= inpPromoStartDate.SelectedDate,
    'End of Week' >= inpPromoStartDate.SelectedDate
    ),
    Week
    ) & "_" & Substitute(
    inpPromoName_frm.Text,
    " ",
    ""
    )

     

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    HI @johnjohn123 ,

     

    Since this is a runtime error, the issue is probably in the order in which the functions are evaluated: The OnSuccess property of the form is trying to pull a value from inpPromoID_frm before its' Default property has been evaluated properly. That is why copying the literal formula to the OnSuccess property makes the issue go away: It is now understood that the formula for this parameter needs to be evaluated before triggering the flow.

     

    I have ran into these types of issues a few times where everything would work when all formulas are evaluated instantaneously, but since in reality they take some time to be evaluated, runtime errors were thrown. Usually I found myself resolving the issue in the same way as you described: substituting the reference to a declarative property with the literal formula as was set for that property. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard