PATCH Conditional Filters

Options

I want to utilize PATCH to update a user's information, but found that I cannot update information on my frontend without filling out all the criteria listed here:

I want it such that a single field can be updated without the need to updated the other fields. For example, only updated a firstname and not lastname, computingid, and years_id

How do I set up a conditional filter to accomplish this goal?

Tagged:

Answers

  • NWold
    NWold Member
    Options

    My intuition was to utilize this:

    But not sure where to go from here.

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    Options

    Hey @NWold!

    I created this video highlighting how you can use conditional filters to update only fields where information is being provided by the front end. Let me know if this is helpful or if you have further questions. 😊

  • NWold
    NWold Member
    edited October 2023
    Options

    Hi so I utilized what you said on the video as such:

    Yet I am still receiving this error:

    What are any common mistakes with this method that would contribute to this error?

  • NWold
    NWold Member
    Options

    This method is doing exactly what I want to accomplish. I am just not understanding why the error is prevalent.

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    edited October 2023
    Options

    Hey @NWold! Can you edit your firstname input and make sure that "Required" is set to no. Let me know if this fixes the issue.

  • NWold
    NWold Member
    Options

    That managed to fix the error, but a new problem arose. A couple variables, most notably firstname and lastname will either become blank if left as "" or it will become blank when I change the value once then leave it as "". For example:

    then the next time around:

    The other values such as ComputingID and years_id are unchanged, which is good, but the firstname and lastname are having these problems.

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    Options

    Hey @NWold, this is interesting. Did anything change in your Edit Record function? I'm trying to replicate this on my end, but I am not seeing the same issue.

    Also, if you could record a quick Loom showing the data you are providing on your inputs and the results you get, that would be greatly appreciated! 🙏 From the screenshots, I'm having difficulty understanding if the field is becoming blank even if you provide data in the input.

  • NWold
    NWold Member
    Options

    I found out the issue was in some marginal issues with inputing my variables. Everything seems to work now! Thank you for the help!

  • Liz Anaya
    Liz Anaya Member, Administrator

    ADMIN

    Options

    Woohoo! 🥳 Thanks for the update, @NWold. Glad to hear everything is working now!