Ejemplo n.º 1
0
def main():

    sf = Salesforce_API('*****@*****.**')


    sf.delete(sf.select("""SELECT Id, Venue__r.Name, Office__r.Name, CreatedBy.Name
    FROM VenueOffice__c
    WHERE CreatedDate = TODAY
    AND Office__r.Name IN('Evenko','Spectra','Groupe CH')
    """))

    offices = {item.Name: item.Id for item in sf.select("SELECT Id, Name FROM Account WHERE Name IN('Spectra','Groupe CH') and RecordType.Name = 'Office'")}

    venueoffices = sf.select(f"""
    SELECT Venue__c, Office__c
    FROM VenueOffice__c
    WHERE Office__r.Name IN('Evenko')
    """, return_type='dataframe')

    new1 = venueoffices.copy()
    new1['Office__c'] = offices['Spectra']
    new2 = venueoffices.copy()
    new2['Office__c'] = offices['Groupe CH']

    sf.add_bypass_settings()
    sf.insert('VenueOffice__c', new1)
    sf.insert('VenueOffice__c', new2)
    sf.remove_bypass_settings()
def main():
    session = Salesforce_API('*****@*****.**')

    lebs = session.select("""
    SELECT Id, ParentRecordTypeName__c, Type__c, Net_Revenue__c, Event__r.TourLegOrder__c, Event__r.EventTitle__c, Event__r.Venue__r.Name, Event__r.Venue__r.OwnershipType__c, Event__r.TourLeg__r.Tour__r.TourTitle__c, LastModifiedDate
    FROM LedgerEntryBreakout__c
    WHERE IsTouringApp__c = True
    AND Event__r.Venue__r.OwnershipType__c = 'Owned/Operated'
    AND ParentRecordTypeName__c NOT IN ('Expenses')
    AND SharedInNetPot__c = False
    AND LastModifiedDate > 2021-01-01T00:00:00Z
    AND Event__r.TourLeg__r.Tour__r.WorkingCopy__c = NULL
    AND Event__r.Venue__r.LineOfBusiness__c IN ('Club','Other','Boutique Amp/Large Indoor','Small Theater/Ballroom')
    ORDER BY Event__r.TourLeg__r.Tour__c, Event__r.TourLegOrder__c
    """)

    session.batch_size = 3
    session.delete(lebs)

    # Add this after RMTE-2295
    # AND Event__r.Venue__r.PrimaryOffice__r.Name NOT IN ('Booklyn Bowl', 'Crossroads')

    return