Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from . import Connection
- def get_samples(project_id=None, order_id=None):
- query = 'SELECT Id, Name, Work_Order__c, Sample__c.Work_Order__r.Name, Order_Opportunity__c FROM Sample__c WHERE '
- if project_id is not None:
- query += 'Sample__c.Order_Opportunity__c = \''+project_id+'\''
- elif order_id is not None:
- query += 'Sample__c.work_order__c = \''+order_id+'\''
- else:
- raise Exception('No projectID or orderId found')
- result = Connection.conn.query(query)
- return list(map(
- lambda sample: {
- 'id': sample['Id'],
- 'name': sample['Name'],
- 'project_id': sample['Order_Opportunity__c'],
- 'order_id': sample['Work_Order__c']
- },
- result['records']
- ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement