Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only
Expand all | Collapse all

Automation script for duplicate record and then open it directly

  • 1.  Automation script for duplicate record and then open it directly

    Posted Mon October 11, 2021 01:58 AM
    Edited by System Admin Wed March 22, 2023 11:55 AM
    Hello,

    I have one requirement that I must create automation script which one will be duplicate created record where I will copy to duplicated record 3 values/attributtes. 

    I have one idea that I will achieve this after record was created user will get pop up dialog where he decides If he wants duplicate record or not. He will click push button "COPY RECORD" and there I created automation script with objectname and action duplicate --> SR.DUPLICATE.

    The problem is, that if I duplicate record how could I make that after click I will duplicate record and at the same time open this duplicated record where user could insert other values? I have to said that this duplicated record is not saved yet is this possible?

    Anyone have any idea?

    ------------------------------
    Blaz Rakar
    ------------------------------
    #Maximo
    #AssetandFacilitiesManagement


  • 2.  RE: Automation script for duplicate record and then open it directly

    Posted Tue October 12, 2021 01:15 PM
    I am not sure you can do what you want here.  But, perhaps you can fill in some more details before we quit trying.   Is this a self service user (I ask because the power app duplicate does bring the user to the unsaved record)?  If it is self service, do you envision the user going to the Create SR page with the data filled in from the original record?

    Steve

    ------------------------------
    Steve Hauptman
    ------------------------------



  • 3.  RE: Automation script for duplicate record and then open it directly

    Posted Wed October 13, 2021 10:07 AM
    Steve's question around whether this is in the self-service app or not is critical.

    To expand on what he's saying, your script on SR.DUPLICATE is already in the right place to handle copying the values over. What you're looking for is that a user clicks a button in your app and that causes it to duplicate the record in question. If you're in a standard power app (such as SR), you already have the event you need to duplicate and move to that record out of the box. For example, if you drag a push button control on your SR record and set the event to DUPLICATE (and the signature option to DUPLICATE to hide the button when someone doesn't have security access) when a user clicks the button it will duplicate the record and automatically open it.



    ------------------------------
    Steven Shull
    ------------------------------



  • 4.  RE: Automation script for duplicate record and then open it directly

    Posted Thu October 14, 2021 04:19 AM
    Edited by System Admin Wed March 22, 2023 11:52 AM
    Okay I understand what are you saying. So application is mobile, so when I click duplicate in my application in my Language "Kopiraj zahtevek". I see this up here, so the record was duplicated. But Application dont open my record its stays at this window..  New(duplicated) record must not be saved yet, I wanna just copy 3 values from previous record which in this case was already saved.


    ------------------------------
    Blaz Rakar
    ------------------------------



  • 5.  RE: Automation script for duplicate record and then open it directly

    Posted Thu October 14, 2021 08:22 AM
    The method I showed would not automatically save the new record in a Power App. It duplicates the record and moves to that record to allow the user to edit while also being able to discard.

    Your app looks to be a custom version of the Create Service Request (CREATESR) app which is a special type of app. Most apps in Maximo are called Power Apps. For example, SR where you have a list tab, main tab, and then subsequent tabs of information. But there are two other types of apps: Single Page App, like Labor Reporting, and Self Service, like the Create Service Request app. These function differently than a traditional Power App. 

    You might be able to still do it in the Self Service app. If you can, it's probably going to be more involved. A push button can invoke an automation script and if you're on 7.6.1.X you can interact with the UI bean classes. You might be able to duplicate the record and move to the record in the bean class but I don't know without looking at the code for the start center apps. Can you confirm you're on 7.6.1.X? If you're on 7.6.0.X the hook for the UI for automation scripts doesn't exist and you would need custom java to do.

    ------------------------------
    Steven Shull
    ------------------------------



  • 6.  RE: Automation script for duplicate record and then open it directly

    Posted Thu October 14, 2021 08:59 AM
    Steven thanks for your answer, so I have a problem, because our version of Maximo is 7.6.0.10. Next year we are going to the newest version of Maximo.

    ------------------------------
    Blaz Rakar
    ------------------------------



  • 7.  RE: Automation script for duplicate record and then open it directly

    Posted Tue June 07, 2022 05:48 AM
    I need an opinion or advice, if this is even possible with automation script DUPLICATE function.

    I have application ASSETS where main object is ASSET. 

    In one section I have table with relationshipt from object ASSET to customObject.

    Something like this:

    So here at this table is main object Custom Object.

    I am trying to create option to duplicate row (I mean MBO like we see on screenshoot) if user want to. CustomObject.DUPLICATE automation script working when I created custom application with my customObject and like this everything works as expected. But here is not working. So I wonder if this is even possible to do?

    ------------------------------
    Blaz Rakar
    ------------------------------



  • 8.  RE: Automation script for duplicate record and then open it directly

    Posted Tue June 07, 2022 08:02 AM
    Your button to duplicate your child object would need to be tied to an automation script action launch point. You would have to handle the logic to actually create a new copy of the MBO (calling mbo.duplicate()) since we only provide an out of the box way to duplicate the main record (IE the Asset in this scenario). The mbo variable in this scenario would be your original record and the .duplicate() will return the new MBO for you to modify as necessary. 

    I haven't had a need to do this so I'm not sure if you'd have any issues such as the table not showing the record until you save and refresh the record. If you're on 7.6.1.X, since our launch point is an action we could potentially handle UI issues.

    ------------------------------
    Steven Shull
    ------------------------------



  • 9.  RE: Automation script for duplicate record and then open it directly

    Posted Thu December 19, 2024 09:05 AM

    Steven,

    I know I am kicking a three year old horse, but I have just recently become involved with Maximo. Before me, a new type of business object called a Visit Request was built on top of an SR. A copy button was created using SR.DUPLICATE. The only visible change I saw when hitting the duplicate button was the REPORTEDBYID was updated to the current user. But, when the Save button was hit, it reverted back to the original value. Also there were six other fields that I felt should have been updated, but they were not:

    ·         affectedemail

    ·         affectedperson

    ·         affectedphone

    ·         reportedby

    ·         reportedemail

    ·         reportedphone

    I would like to update these fields as well, but I cannot determine how to change the behavior of SR.DUPLICATE and I do not know how to add another function, perhaps SR.COPY or SR.DUPLICATE2

    I am an old database guy who has used Java, C, C++, Perl, and others, so perhaps I have got to shed my old ways. But I have not had any Maximo training and am flying by the seat of my pants.

    Thanks for any help,

    /dave



    ------------------------------
    david reynolds
    ------------------------------



  • 10.  RE: Automation script for duplicate record and then open it directly

    Posted Fri December 20, 2024 02:17 AM

    Sorry, I'm not steven :)

    Reason could be crossover domain TCKT2TCKT, which has also field REPORTEDBY. Maybe You need to remove it from that crossover domain.



    ------------------------------
    Juris Flugins
    ------------------------------