Script: Transfer Address Layout of One Address to Other Address

Apply address layout to all addresses of type

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 30.01.2004
Updated: 23.02.2019 | Script translated into Python. VBScript removed.

Takes the address layout of the current address and carries over it to all addresses from the same   Address type (simple address, company, person, contact or couple).

Version

Version description Scripting
from version 5.8 Python scripting AddLayoutToAllOfType.py

Execute

Single address containing the layout to be transferred.

Script text

#---Description: Carry over the address layout of one address to another
# Class: Address Entry
#   ObjectScript: Yes
#   ContainerScript: No
#   EventType: None
#---This script takes the address layout of the current
# address and carries over it to all address entries that
# are of the same type (Single Address, Company, Person or Contact).
#---30.01.2004, Vertec AG: created
#---07.05.2007, sr: Adapted to argobject and vertec
#---04.03.2008, cp: Supplement by dynamic Formofaddress and salutation
#---30.04.2009, bn: On Error added to intercept errors
#---25.10.2013, sr: changed msgox to vertec.msgbox
#---22.02.2019, sth: Script rewritten in Python

def main():

    vtcapp.updatedatabase

    obj = argobject
    if obj.eval('oclisKindOf(address)'):
        layout = obj.defaultaddress
        lay = layout.adresslayout
        typ = obj.evalocl(“oclType.asString”)
        adrlist = vtcapp.evalocl(type + “.allInstances”)
        for address in adrlist: 
            try:
                address.anredetemplate = obj.anredetemplate
                address.briefanredetemplate = obj.briefanredetemplate
                layout = address.defaultaddress
                layout.adresslayout = lay
            except:
                if vtcapp.msgbox(“The address layout could not be set for the following address: %s. Do you want to continue?” % address.evalocl(“self.asstring”),4) == 6:
                    continue
                else:
                    return
    else:
        vtcapp.msgbox(“This script must be executed on a single address from which the layout will be carried over to all addresses of this type.”)

    vtcapp.updatedatabase
    
main()



Bitte wählen Sie Ihren Standort