Copy functionality in Grails application

Following is easy code you can implement a Grails application to implement copy functionality:-

list.gsp

The primary key is passed as a parameter to the create action which effectively creates a blank template and fills up with existing record

<td><g:link action="create" params="${processParamAssignInstance.getPK()}">Copy</g:link></td>

Domain class

Here defPK contains all the variables which make up the composite key of the domain class

def getPK(){
["workCenterCode":workCenterCode,"mfgAreaLoc":mfgAreaLoc,"oper":oper,"processParamTemplate":processParamTemplate,"fab":fab,"matchValue":matchValue,"paramName":paramName]
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s