Jump to content

This topic is 7758 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Looking for an idiots guide to deleting portal records. Have managed to add & edit but having problems with delete. I've read elsewhere that a button should be used with an associated "Delete portal Row[]" script however I'm having little success. Additionally when using CurrentRecID as a hidden field the parent record was being deleted so attempted to use CurrentPortalRowNumber but this gave me a 101 error.

Any help much appreciated.

Iain

Posted

Make sure you actually Go to portal row[] or a Delete Record/Request will delete the current record and its child records.

I usually find it best to Go to Related Record[show, ID] and run an external script to Delete Record/Request from the related file. Then I know there's no possible way my parent can accidentally be deleted. I would also deselect the 'Allow deletion of portal records' in the formatting for your portal so that no one can inadvertently trash related records.

Posted

The only method that I've found is, as Anatoli said, by deleting the record directly from the related file. I've had to do this by creating a Calculated field which outputs the RecID of the related record.

It is a bit of a pain to have to do it this way. Wish there were a better way!

Good Luck.

Garry

  • 2 months later...
Posted

Garry,

Could you please explain your method in a little more detail with some sample code? I understand the concept, but am unsure how to implement it.

I'm starting to work with portals via CDML and was looking to be able to delete and/or edit certain rows of any portal. I already figured the adding a row part smile.gif

Any help with deleting and/or editing portal rows, is much appreciated. Thanks!

-Justin

Posted

I create a Calculated field in the related file which returns the RecID, e.g.???

Status(CurrentRecordID)

This field is placed in the Portal, of the parent, on the Layout used for the Web.

I then create a Form in my editing page which will be used for deleting related records (Portal Rows):

<form name="rmvrowfm" action='/FMPro' method='post' target='quote'>

<input type="hidden" name="-db" value="quote_line_items.fp5">

<input type="hidden" name="-lay" value="web">

<input type="hidden" name="-format" value="editreturn.html">

<input type="hidden" name="-recid" value="">

<input type="hidden" name="-delete">

</form>

Within the portal display (line-items) on the page I have a "Remove" link at the end of each row:

<a href="Javascript:rmvrow('[FMP-Field:quote_rel::rec_id]');">Remove</a>

This link calls a Javascript function declared in the <head> of the page:

function rmvrow(rmvrecid)

{

if (confirm("Remove Item?")) {

document.rmvrowfm.elements["-recid"].value = rmvrecid ;

document.rmvrowfm.submit() ; } ;

}

Hope this helps.

Garry

This topic is 7758 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.