Forced save of Object

SOLVED

Hi

I've added a button to the Sales Order window ("z") which, when clicked, updates a date field on the screen. The modification of this field triggers a workflow which sends emails off.

I've used a button to do this because its more obvious to users to click a button to trigger these emails rather than just filling in a date field. I only want these emails sent off once and it's not necessarily when the order is created, hence the manual trigger using this field

the code i've added in SPESOH is this:

$EXEBOUT

   If BOUT = 'z'
        [M:SOH0]YCISDATE=date$
        [F:SOH]YCISDATE=date$
        Affzo [M:SOH0]YCISDATE

 Endif

Return

however, the date field does not get updated to the file unless I force a save of the record (by changing some other field and then saving)

how do I update the new date field and simultaneously update the table on the click of the button

thanks 

  • 0
    verified answer
    I think I must be missing something important on your question, but I'm going to give this feedback, and you can let me know if we need to re-calibrate or not.

    1. Open a transaction (Trbegin)
    2. Set the value
    3. Issue a Rewrite on the F buffer, [F:SOH] in your case. This assumes your SOH record already exists. If it doesn't, you'll issue a write instead.
    4. Perform an FSTAT on the rewrite operation
    5. Read the screen from the buffer
  • 0 in reply to Delamater
    thanks Delameter - i was missing the rewrite.

    on another note (very unprofessional!): do you know what the arguments are for the ETAT subroutine. I don't know what the ?'s are meant to represent
    call ETAT(reportname,destination,?,?,?,param(1),val(1))

    thanks
  • 0 in reply to Delamater
    Good evening,

    Can you show the piece of code, to see how can i do it?

    Best Regards,

    Ricardo Perfeito
  • 0 in reply to Ricardo Perfeito
    If [F:BPS]NORPRNFLG=2 & [F:PTR]DOCFLG=2 & [F:POH]APPFLG>2 & !GIMPORT
    Local Char TBPAR(10)(1..50),TBVAL(30)(1..50)
    Gosub SET_CLE From GOBJSUB : CLECUR=1 : # SET_CLE parce que création
    #-----
    If [M:POH0]DOCNAM<>"" [L]REPORT1=[M:POH0]DOCNAM Else [L]REPORT1=[F:PTR]DOCNAM : Endif
    #-----
    Call ETAT([L]REPORT1,"GESPOH",TBPAR,TBVAL) From ETAT
    #Call ETAT([L]REPORT1,"","",0,"",TBPAR,TBVAL) From AIMP3 : # Erreur PARAM inexistant !!
    #----- Relecture pour réactualisation de l'indicateur d'impression -----#
    Raz [M:POH2]POHCOU
    Gosub RELIT From GOBJSUB
    Affzo [POH2]10 : Affzo [POH3]15
    Else