jrossausiscom
5 years agoQrew Assistant Captain
Copying the Children of a Parent only (Code Assistance needed)
Currently working on a new app for our company in which I am changing some items and reusing or rebuilding others.
I ran into an issue with a URL button. What I need it to do is copy the related children of a parent (but NOT the parent) then related said new copies to the work request the user is in. Basically the chosen type is holds the "templates" and the copies will become the "live" records.
At a high level, this is what I need.
Here is what I have so far based on the old code from the old app. Note that I replaced the table ID's with simple names just for the ease of this discussion, the actual code has the real values. Lastly, note that the "Transactions" items have been commented out as I do not know if I will need them, so i am keeping them commented for now.
When I run this code, I just get a "page cannot be found" error. Any ideas? This code is almost identical to the old one except that the old one has one less set of actions and no comments...
------------------------------
John Ross
------------------------------
I ran into an issue with a URL button. What I need it to do is copy the related children of a parent (but NOT the parent) then related said new copies to the work request the user is in. Basically the chosen type is holds the "templates" and the copies will become the "live" records.
At a high level, this is what I need.
- Children of the Related Staging Type are copied
- The fresh copies are related to the Request and Job.
- The fresh copies have their template checkbox deselected and the service date put in. This filters them from the original templates.
- Once done, the script should return the user to the request so they can check the data.
Here is what I have so far based on the old code from the old app. Note that I replaced the table ID's with simple names just for the ease of this discussion, the actual code has the real values. Lastly, note that the "Transactions" items have been commented out as I do not know if I will need them, so i am keeping them commented for now.
When I run this code, I just get a "page cannot be found" error. Any ideas? This code is almost identical to the old one except that the old one has one less set of actions and no comments...
//Java Magic? (Copies the Children, does NOT copy parent [hopefully])
"javascript:void(window.open('" & URLRoot() & "db/" & Dbid() & "?a=dbpage&dbid=" & "Parent Table"
& "&pagename=copyParentChild-Select.html&onlyDBIDs=FINACIALS.COSTS.CONFIGS.TRANSACTIONS&rid=" & URLEncode([Related Project Staging Type])
//Related the Children to the Staging Request
& "& dest=refresh&destrid=null & FINACIAL-43=" & URLEncode([Staging ID]) //Relates Financials to the Staging Request
& "& COSTS-49=" & URLEncode([Staging ID]) //Relates Costs to the Staging Request
& "& CONFIGS-31=" & URLEncode([Staging ID]) //Relates Configs to the Staging Request
// & "& TRANSACTIONS-24=" & URLEncode([Staging ID]) //Relates Transactions to the Staging Request
//Relates the Children to the Job
& "& FINACIALS-44=" & URLEncode([Related Job]) //Relates Financials to the Job
& "& COSTS-34=" & URLEncode([Related Job]) //Relates Costs to the Job
& "& CONFIGS-32=" & URLEncode([Related Job]) //Relates Configs to the Job
// & "& TRANSACTIONS-17=" & URLEncode([Related Job]) //Relates Transactions to the Job
//Encodes Today's Date, and Unchecks Template
& "& FINACIALS-34=" & URLEncode(Today()) //Relates Financials to the Job
& "& FINACIALS-33=" & URLEncode(false) //Unchecks Template in the Financials
& "& COSTS-35=" & URLEncode(Today()) //Relates Costs to the Job
& "& COSTS-31=" & URLEncode(false) //Unchecks Template in the Costs
& "& CONFIGS-33=" & URLEncode(Today()) //Relates Configs to the Job
& "& CONFIGS-34=" & URLEncode(false) //Unchecks Template in the Configs
// & "& TRANSACTIONS-17=" & URLEncode(Today()) //Relates Transactions to the Job
// & "& TRANSACTIONS-17=" & URLEncode(0) //Unchecks Template in the Transactions
//Creates the window?
& "','copyRecursive','top=240,left=320,width=400,height=150,location=no,menubar=no,toolbar=no'))"
------------------------------
John Ross
------------------------------