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 / "Invalid argument type...
Power Apps
Suggested Answer

"Invalid argument type. can not use boolean in this Context" inside OnOkClick inside a Component

(1) ShareShare
ReportReport
Posted on by 1,811 Super User 2024 Season 1
I want to build a reusable popups as mentioned in this link https://www.youtube.com/watch?v=SfxNHYvCgcw&pp=ygUhcmV1c2FiZWwgcG9wdXBzIGluc2lkZSBwb3dlciBhcHBz , using the "Enhanced components" feature:-
 
 
So, I have  created a component library inside a solution, with 3 properties, 2 of them of type Event (named OnOkClick & OnOkCancel), as follow:-
 
 
 
 
Then inside the "Custom Properties" >> "OnOKclick", i added this formula, which mainly do some checks and delete the items:-
 
ClearCollect(
    varWOWOInfoDetails,
    Filter(
        'Work Orders Work Order Info Details',
        'Work Order ID' = DashBoardGallery_1.Selected.ID
    )
);
ClearCollect(
    varWOSP,
    Filter(
        'Work Orders Spare Parts',
        'Work Order ID' = DashBoardGallery_1.Selected.ID
    )
);
 
ForAll(varWOSP As wosp,
Collect(
    varWOSPWOSPAPP,
    Filter(
        'Work Order Spare Parts Work Order Spare Part Approvals',
        'Work Order Spare Part ID' = wosp.ID
    )
));
 
IfError(RemoveIf(
    'Work Orders',
        ID = DashBoardGallery_1.Selected.ID
),
Notify(
    "Can not delete work order",
    NotificationType.Error
),
ForAll(varWOWOInfoDetails As wowo,
RemoveIf('Work Orders Work Order Info Details',ID=wowo.ID);
RemoveIf('Work Orders Info Details',ID=wowo.'Work Order Info Detail ID')
 
);
ForAll(varWOWOInfoDetails As wowo,
 
RemoveIf('Work Orders Info Details',ID=wowo.'Work Order Info Detail ID');
RemoveIf('Work Orders Work Order Info Details',ID=wowo.ID);
);
 
ForAll(varWOSP As wosp,
 
RemoveIf('Work Orders Spare Part Details','Work Order Spare Part ID'=wosp.ID)
 
);
 
ForAll(varWOSPWOSPAPP As wospwoapp,
 
RemoveIf('Work Orders Spare Part Approvals',ID=wospwoapp.'Work Order Spare Part Approval ID');
 
);
ForAll(varWOSPWOSPAPP As wospwoapp,
 
RemoveIf('Work Order Spare Parts Work Order Spare Part Approvals',ID=wospwoapp.ID);
 
);
 
ForAll(varWOSP As wosp,
 
RemoveIf('Work Orders Spare Parts',ID=wosp.ID);
 
);Notify(
    "Deleted successfully",
    NotificationType.Success
););
 
UpdateContext({showPopup: false});
Set(selectedID,DashBoardGallery_1.Selected.ID);
Set(
    selectedID,
    Blank()
);
Set(
    varPrintProcessID,
    Blank()
);
Set(
    varPrintProcessPrintOrder,
    Blank()
);
Set(
    varPostingUnPotingProcess,
    Blank()
);
Set(
    varPostingUnPotingProcessPostingUnPostingForms,
    Blank()
);
 
 
but on the first semi-colon i get this error:-
 
 
here is the error:-
 
 
also despite this error the code is working on Test environment and partially working on PROD.. so what is causing this error?
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,433 Super User 2025 Season 2 on at
    Hi
     
    If you created a function or action or event that is supposed to RETURN a Boolean then you need too(at the end of your code end of it, not where its showing you the error), add it to the end.
     
     
    literally just add
     
    true
     
    or 
     
    false
     
    at the end.
     
  • johnjohnPter Profile Picture
    1,811 Super User 2024 Season 1 on at
    But why i need to return a boolean? i did not get the point exactly? Thanks

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