stb-kslater3 / Admin_Checklist

Tool used by Sales Team to determine Quotes, and other things
0 stars 0 forks source link

Saving AdminPOs #12

Closed stb-kslater3 closed 3 years ago

stb-kslater3 commented 3 years ago

As things stand right now there are a couple of Issues when it comes to saving Admin POs.

  1. They save multiple copies of the same thing. Sometimes you may have to 'Other' POs with the same Price and Description, but this is saving multiple copies of the same PO. Such as the AOrder on David's STE10216.
  2. When you remove an Admin PO, it only removes it from the page, but doesn't actually remove the Admin PO. I need to delete the Admin PO records when you click Save, after having clicked remove from on the Admin Checklist page.
stb-kslater3 commented 3 years ago

Right now I am working on blacklisting the Admin POs which you have clicked Remove, and when you save I will go and Delete those records.

stb-kslater3 commented 3 years ago

Making deleteRecords method in Apex_Generic_Prototype.

stb-kslater3 commented 3 years ago

I made the delete records, and solved the issue that was coming up when saving AdminPOs would throw an error. When I go to save AdminPOs I check if it needs to be Inserted or Updated, and I do this by checking for the Id of the AdminPO from the data-apiid element. Well, turns out that the Chassis was getting pulled from a PO and not an AdminPO and it's data-apiid was evaluating to true. Turns out that it was neither undefined, nor was it '', instead it was the string 'undefined' itself. So it didn't evaluate to falsy because it was neither undefined nor ''. Took a while to find, and I am not sure if it is a bug in JavaScript or Salesforce's LWC overhead, that causes this to neither be undefined nor '', but instead 'undefined' which when you print says undefined so you think it should be falsy but then it isn't.

Anyways, now I have fixed that and now just need to figure out what is causing things to insert sometimes, when they should be updating which makes for creating a bunch of copies.

stb-kslater3 commented 3 years ago

Now that I modified the Insert and Update methods for AdminPOs in the AdminChecklist LWC this is no longer a problem