Update Shift Info On Shift Paste callout
This callout retains the published or unpublished shift status when it is copied and pasted in ASV Mass Edit mode.
- Navigate to Maintenance > System Administration > Scriptable Extensions > Extension Script.
- Click New.
- Specify this information:
- Script Name
- Specify a name for the script.
- Description
- Optional. Leave the field blank.
- Script Type
- Specify mvs-callout-updateshiftinfoonshiftpaste and press Enter on your keyboard to load the Whitelists information.
- Template
- The callout name Update Shift Info On Shift Paste is automatically filled in.
- Time Limit (seconds)
- The default value is 120.
- Memory Limit (kilobytes)
- The default value is 100.
- Script
- Copy and paste the groovy script:
package com.workbrain2.ta.publ.api.v7_0_0 import com.workbrain2.emvs.publ.api.LayeredShiftPublService import com.workbrain2.emvs.publ.api.MVSPublicServiceAccess import com.workbrain2.emvs.publ.api.ShiftSummaryPublService import com.workbrain2.emvs.publ.api.callout.UpdateShiftInfoOnPasteScriptable import com.workbrain2.emvs.publ.api.domain.LayeredShiftPubl import com.workbrain2.emvs.publ.api.domain.LayeredShiftPublBuilder import com.workbrain2.emvs.publ.api.domain.ShiftSummaryPublBuilder import com.workbrain2.emvs.publ.api.domain.UnassignedShiftSummaryPubl class ChangePublishStatus extends UpdateShiftInfoOnPasteScriptable { LayeredShiftPubl updateShiftInfo(LayeredShiftPubl sourceShift, LayeredShiftPubl targetShift) { ShiftSummaryPublService shiftSummaryPublService = MVSPublicServiceAccess.shiftSummaryPublService ShiftSummaryPublBuilder shiftSummaryPublBuilder = shiftSummaryPublService.getShiftSummaryBuilder() shiftSummaryPublBuilder.init(targetShift.shiftSummary) if(sourceShift.shiftSummary.status == UnassignedShiftSummaryPubl.Status.UNPUBLISHED) { shiftSummaryPublBuilder.setShiftSummaryStatus(UnassignedShiftSummaryPubl.Status.STATELESS) } else { shiftSummaryPublBuilder.setShiftSummaryStatus(sourceShift.shiftSummary.status) } LayeredShiftPublService layeredShiftPublService = MVSPublicServiceAccess.layeredShiftPublService LayeredShiftPublBuilder layeredShiftPublBuilder = layeredShiftPublService.getLayeredShiftBuilder() layeredShiftPublBuilder.setShiftSummary(shiftSummaryPublBuilder.build()) layeredShiftPublBuilder.setShiftDetails(targetShift.layeredShiftDetail) layeredShiftPublBuilder.build() } }
- Click Save.
- Navigate to Maintenance > System Administration > Scriptable Extensions > Extension Script Callouts.
- Click the Edit option for the Update Shift Info On Shift Paste callout name.
- In Script Name, select the name you specified.
- Click Submit.