Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Delete Record Request Issue


mjhnson24
 Share

Recommended Posts

OK ill try to explain this the best i can. Im not able to post the DB cause it was initially designed with multiple files connected.

 

I have a file called "Customer Scripts", i also have a file called "OHC_Data". In Customer Scripts file, each record can have multiple paragraphs associated via CustomerScriptID. I have a script written that goes and loops through a portal and grabs all paragraph IDs and sets them as a return delimited variable. Once finished it performs a script called "test" inside customer scripts file and passes the paragraph IDs and the customer script ID along as a parameter. That "test" script inturn performs a script called "Test Script" directly inside the "data" file and goes and finds that specific record and just performs a delete record request.

 

Its a very simple script. When the data file performs that script, it does indeed find the correct record and it steps into that "Delete Record Request" step like it is suppose to and performs it but the problem is it wont actually delete the record allthough it just performed that delete record step. I honestly dont get it.

 

And heres why, That "Test" script inside customer scripts i can hard code a variable and pass that variable to the same script not changing anything but the variable that im hard coding instead and it goes to the data file and finds the record and it will actually delete the record. The same script from before the only thing different is i ran the "Test" script manually inside customer scripts instead of having it run from another script. Everything performs like it is suppose to and passes the correct data and finds the correct data but one way deletes the record and the other one dont.

 

Its driving me bonkers.

Link to comment
Share on other sites

Its a very simple script. When the data file performs that script, it does indeed find the correct record and it steps into that "Delete Record Request" step like it is suppose to and performs it but the problem is it wont actually delete the record allthough it just performed that delete record step. I honestly dont get it.

 

What kind of layout are you on -- and where on the layout is the record -- with respect to the record you want to delete?

 

Are you trying to delete a portal record?

 

 

The rule of thumb is if you can do it stepwise with commands or keystrokes then you should be able to with a script - but your experience idicates that something is different that is not being accounted for.

Link to comment
Share on other sites

What kind of layout are you on -- and where on the layout is the record -- with respect to the record you want to delete?

 

Are you trying to delete a portal record?

 

 

The rule of thumb is if you can do it stepwise with commands or keystrokes then you should be able to with a script - but your experience idicates that something is different that is not being accounted for.

 

 

Well the CustomerScripts layout is a form view layout and has a portal on it related to the current script record being viewed. The script loops through the portal getting all the ParagraphIDs that has been marked to remove. At that point it passes those IDs to the data.fp7 file which is not an interface layout its just a bunch of layouts that relate to each table. the user doesnt see that data.fp7 file at all. the script that gets the IDs that was passed to it just goes to the paragraph layout table that is a join table between the customer scripts table and the actual paragraph table.

 

If i click the Run button in scripts manager inside customer scripts with hard coded IDs in a variable in a script called (test) and pass it to the script inside data.fp7 called (test script) it will run and delete the record But if i have a script passing data via variables to the script called (test) inside customer scripts then pass that to the script called (test script) in data.fp7 it will not delete the record. Only difference between the two scenarios is im hard coding variables in the scenario that actually deletes the record and the other one im looping through the portal to get the IDs and then passing them. Both scenarios will pass the same IDs either hardcoded (which works) or looping portal to get the IDs (which dont work).

 

i dont understand why running the scripts manually through scripts manager witht he play button works but running the same scripts but from another script on a button, passing the same data correctly and both finding the same record, doesnt work. It performs the delete record request but will not delete it for some reason. If i step through both scenario scripts they perform the same way as normal, hard coded manually works the other way dont but i see it finding the record and passing the same data.

Link to comment
Share on other sites

 

If i click the Run button in scripts manager inside customer scripts with hard coded IDs in a variable in a script called (test) and pass it to the script inside data.fp7 called (test script) it will run and delete the record But if i have a script passing data via variables to the script called (test) inside customer scripts then pass that to the script called (test script) in data.fp7 it will not delete the record. Only difference between the two scenarios is im hard coding variables in the scenario that actually deletes the record and the other one im looping through the portal to get the IDs and then passing them. Both scenarios will pass the same IDs either hardcoded (which works) or looping portal to get the IDs (which dont work).

 

You are using global variables (the kind with the $$ preceding the name) in the script that fails, right?

Link to comment
Share on other sites

nope. no global variables in any of the scripts. the two scripts called (Test) & (Test Script) are the same scripts that work by them selves ran manually by just clicking the green play button in scripts manager as long as im on the correct layout and those are also called by another inistial script on a button on the layout i initialize it from and thats when it wont delete. Both scenarios passes the same data via local variables to the data file that ends with the (test script) and both find the same record but one scenario works and one doesnt. I can give you my cell number if you want but thats upto you if that helps better.

Link to comment
Share on other sites

1) Try using global variables if one script runs and hands off data to another script. You could use global fields to do the same thing. Are you running Advanced? If so, there is a script debugger that might help.

 

2) When running the faulty scripts is/are there any layout changes (or different TO's) such that the script either goes to the wrong place to execute a command or is not finding the correct contextual data?

 

The more the complex your app(s) the more complex the problems! Try using global fields to store the information you want the unattended script to pass along and ultimately delete. If you can narrow down some/most of the correctly working script steps it may let you focus on the faulty one. There is probably one or two small errors that with a little digging you will have that "Ah-ha" moment and see the problem.

Link to comment
Share on other sites

1) Try using global variables if one script runs and hands off data to another script. You could use global fields to do the same thing. Are you running Advanced? If so, there is a script debugger that might help.

 

2) When running the faulty scripts is/are there any layout changes (or different TO's) such that the script either goes to the wrong place to execute a command or is not finding the correct contextual data?

 

The more the complex your app(s) the more complex the problems! Try using global fields to store the information you want the unattended script to pass along and ultimately delete. If you can narrow down some/most of the correctly working script steps it may let you focus on the faulty one. There is probably one or two small errors that with a little digging you will have that "Ah-ha" moment and see the problem.

 

 

Yea i am running advanced and ive done that on both scenarios and it passes the data correctly to all scripts involved not matter what. And both do find the correct record. i mean i can use global variables if need be but ill have to try that tomorrow when i get back to work but not sure if that would work any different sicne both scenarios pass the same data correctly.

 

Well thats just it both pass the same data and they both go to a layout and find the same record and both scenarios run the delete record request but one actually deletes the record like its suppose to and the other doesnt.

 

Scenario 1: i click a button that opens a smaller window with the same relationship portal. you click a check box next to each paragraph u wanna delete. Click continue (this is the starting script) Its called "Continue removal". that loops through that portal and sets a variable with all the IDs that was selected. it passes the IDs to a script called "Test". that in turn passes the data from the customer scripts file to an external data.fp7 file that basically loops through the return delimted variable to grab each ID one at a time and finds the record and deletes it if it finds it or it is suppose to delete it. It finds the record successfully and it performs the Delete record/request step but it dont delete the record like it should have and it just performed the delete record request sicne the find was true.

 

Scenario 2: i change the variable inside "Test" script inside the customer scripts file with that window open and it in turn passes the data to the data.fp7 file and finds it and sicne it successfully finds it it performs the delete record request and it actually will delete the record. The same record that gets found in scenario 1.

 

So you can see "Test" and "Test Script" runs in both scenarios its just scenario 1 runs them from a starting script on a button is all.

 

script called 'Continue Removal' is in Customer Scripts.fp7 file (standard form layout)

script called 'Test' is in Customer Scripts.fp7 file (standard form layout)

script called 'Test Script' is in data.fp7 file (standard form layout)

Link to comment
Share on other sites

Ive attached the three scripts that is being used. The script named "ContinueScriptChanges" Runs by clicking a button. it in turn runs the script named "Test" which runs the script named "TestScript" which that script resides in the data.fp7 file separate file from the customer scripts file. If i click the button to run "ContinueScriptChanges" it will perform correctly and will find the record correctly and $cStatus is equal to true so it will perform the Delete Record Request inside the "Test Script" script but wont delete.

 

If i run the script named "Test" on its own and enable the second variable you see and disable the top one to switch so i can run that "Test" script manually it passes the same data i just skip the "ContinueScriptChanges" Button that loops through the portal to get all the IDs, that manual way does the same thing and $cStatus is still equal to true but will delete the record.

 

Thats the part i dont understand. They both get the same exact data just differently but they both get passed the same way to the same script and they both find the same record and they both have $cStatus = True and they both perform the Delete Record Request just dont know why one will actually delete the record but the other one dont. It performs the delete record step like it is suppose to but the record just wont delete. Theres nothing with either of my scripts. They both pass the same data.

 

 

Mark

Link to comment
Share on other sites

I think your problem is that the way the scripts are running you are getting two different variables declared somewhere such that one works while the other that is different (the variable) does not.

 

The solution is the same as I suggested above. For EACH variable that you select in EACH script create a global field in that table, and run the script. Make a note of the values. Then run the script the "other way." Look for different results.

 

EDIT: It looks like the ScriptParameter that "ContinueScriptChanges" passes along is different than that generated from the script "Test" generates.

Link to comment
Share on other sites

Yea ill have to look at it in more detail and maybe try to re write it differently somehow. Ill keep ya posted on the results

Link to comment
Share on other sites

If you're sure you're on the right record, then I don't think it's a problem with the variables or parameters.

 

You say when you step through the script it does the Delete Record step, it just doesn't actually delete it. I can think of a couple reasons this might be so, and each could be seen if you turn off the error capture in the script.

 

First, it could be a privilege problem. Perhaps you've eliminated this already.

Second, the record could already be open by another window or another user. This is harder to see just by looking at the script, but easy to see if you turn off the error capture or look at the script debugger as errors are captured.

 

If you find conditions that are leaving the record open in another window, Commit Records[] while in that window will take care of it.

Link to comment
Share on other sites

 

First, it could be a privilege problem. Perhaps you've eliminated this already.

Probably not this since user can delete records by using scripts 2-3 in sequence, but not with scripts 1-2-3 in this sequence.
Second, the record could already be open by another window or another user. This is harder to see just by looking at the script, but easy to see if you turn off the error capture or look at the script debugger as errors are captured.
Possible
Link to comment
Share on other sites

Yea i ruled out the privilege set thing since im in admin mode allthough not related to this issue i did try to delete a found set of records i created by accident in my customer scripts file and i was in admin full access mode but it still said i didnt have access privileges to delete records. Another issue not related to this one though.

 

I have stepped through it and each one passes the correct data and does the same thing jsut one deletes the other doesnt. The one that deletes the record will delete it if im in debug mode or in normal mode and the other one no matter if im in debug mode or not it wont delete the record and after stepping through it, it does perform the delete record request step jsut dont delete it.

 

Have you ever been at that moment where you just wanna throw everything on your desk (including mac computer) through the window? Well guess which moment in time im at. lol

Link to comment
Share on other sites

ok if you look at the script called CustomerScriptChanges, youll see variable called null then close window then exit script. That section was below the second loop string. Youll see 2 loop steps in that script. That stuff was below that second loop. i moved it between the 2 loops and disabled that exit script and it seemed to work great. the one i posted is the one that actually worked. i modified the script before i attached that pdf to the forum post and didnt run it since and jsut ran it since i made that change and it worked. Have no idea why it worked now but not the other way but it did.

 

There was another variable in that script called $array that i disabled as well. So im not sure which one actually did it but after doing all that it worked perfectly. Weird thing is, that pop up window had a portal list on it that was from the same exact relationship as the customer scripts window i went to after i closed the window with that close window step you see in the CustomerScriptChange script. So im not sure why it wouldnt work even though both was finding the same record but it does work now.

Link to comment
Share on other sites

ok if you look at the script called CustomerScriptChanges, youll see variable called null then close window then exit script. That section was below the second loop string. Youll see 2 loop steps in that script. That stuff was below that second loop. i moved it between the 2 loops and disabled that exit script and it seemed to work great. the one i posted is the one that actually worked. i modified the script before i attached that pdf to the forum post and didnt run it since and jsut ran it since i made that change and it worked. Have no idea why it worked now but not the other way but it did.

 

There was another variable in that script called $array that i disabled as well. So im not sure which one actually did it but after doing all that it worked perfectly. Weird thing is, that pop up window had a portal list on it that was from the same exact relationship as the customer scripts window i went to after i closed the window with that close window step you see in the CustomerScriptChange script. So im not sure why it wouldnt work even though both was finding the same record but it does work now.

 

So I bet you don't want to throw the computer out the window now!

 

Yes, both of those things caught my eye. But the array step had been disabled and I am not sure what the null step accomplished.

Link to comment
Share on other sites

So I bet you don't want to throw the computer out the window now!

 

Yes, both of those things caught my eye. But the array step had been disabled and I am not sure what the null step accomplished.

 

 

 

Lol. no not anymore. I think im good now. But i was on the verge of doing it though.

 

The null step actually sets what i call a window global variable. So what ever the window name is that i am currently in whether its a normal window or pop up window, i set a variable to null and set its value witha custom function i found to null and that tells me when im reading the script that its a window global variable just for that window. The variable looks something like this:

 

(CustomerName=Mark|Company=Onholdcompany)

 

If i use window.get ( "CustomerName" ) in a setfield or calculation anywhere on that layout it gets Mark as the value. Same for window.get ( "Company" ), it gets Onholdcompany as the value. Its a function i use very often.

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

Terms of Use