当前位置: 首页>>代码示例>>Python>>正文


Python Salesforce.query方法代码示例

本文整理汇总了Python中simple_salesforce.Salesforce.query方法的典型用法代码示例。如果您正苦于以下问题:Python Salesforce.query方法的具体用法?Python Salesforce.query怎么用?Python Salesforce.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在simple_salesforce.Salesforce的用法示例。


在下文中一共展示了Salesforce.query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: index

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
def index():
    sf = Salesforce( username=u, password=p, security_token=k )

    if request.vars.id == None:
        redirect( URL(a='bih',c='default',f='index') )

    users = sf.query(\
        ''.join( [ "Select ID, Date_of_First_Login__c ",
                   "FROM BIH_USER__C" ] ) )['records']

    result = [ ]

    try:
        record = sf.query(\
            ''.join( [ "Select ID, Date_of_First_Login__c, First_Name__c, Last_Name__c, Email__c, ",
                       "(Select BIH_BUS__R.ID, BIH_BUS__R.NAME FROM TEAM_Members__r) ",
                       "FROM BIH_USER__C WHERE ID = '", request.vars.id, "'" ] ) )['records'][0]

        if record['Date_of_First_Login__c'] is not None:
            redirect( URL(a='bih',c='default',f='index') )

        session.userId = record['Id']

        if record['Team_Members__r'] is not None:
          session.busId = record['Team_Members__r']['records'][0]['BIH_Bus__r']['Id']

        return dict( user = dict(
            id = record['Id'],
            firstName = record['First_Name__c'],
            lastName = record['Last_Name__c'],
            emailAddress = record['Email__c'] ) )
    except:
        redirect( URL(a='bih',c='default',f='index') )
开发者ID:cbaron,项目名称:bih,代码行数:35,代码来源:register.py

示例2: Dashboard

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
class Dashboard(object):
    def __init__(self, active_users, query_string):

        self.credentials = sfconf.credentials
        self.active_users = active_users
        self.query_string = query_string
        self.sf = Salesforce(
            username=self.credentials["username"],
            password=self.credentials["password"],
            security_token=self.credentials["security_token"],
        )

    def get_salesforce_data(self):

        query_results = self.sf.query(self.query_string % self.active_users)
        query_results = query_results["records"]
        result = {}
        users = self.sf.query("SELECT id, Name FROM User WHERE isActive = true")
        users = users["records"]
        user_names = {}
        sales_names = []
        print query_results

        for user in users:
            user_names[user["Id"]] = user["Name"]

        for query_result in query_results:
            if user_names.has_key(query_result["OwnerId"]):
                result[user_names[query_result["OwnerId"]]] = query_result["expr0"]
                sales_names.append(user_names[query_result["OwnerId"]])

        return result, sales_names
开发者ID:SergeyLatsarus,项目名称:AsteriskStat,代码行数:34,代码来源:dashboard.py

示例3: search_organizations

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
def search_organizations(request):

    sf = Salesforce(instance_url=request.session['sf_instance'], session_id=request.session['sf_session'])

    orgname = u"%{orgname}%".format(orgname=clean(request.GET['orgname'])) if request.GET['orgname'] else settings.DEFAULT_ORG_NAME

    sforg_query = u"SELECT Id, Name FROM Account WHERE Name LIKE '{orgname}'".format(orgname=orgname)

    if 'orgid' in request.GET and request.GET['orgid'] != u'' and request.GET['orgid'] != settings.DEFAULT_ORG_ID:
        print type(request.GET['orgid'])
        sforg_query = sforg_query + u" OR Id = '{orgid}'".format(orgid=clean(request.GET['orgid']))

    sforg_query = sforg_query + u" LIMIT 7"

    hashkey = base64.b64encode(str(sforg_query.__hash__()))

    sfresults = cache.get('orgsearch-%s' % hashkey)
    if sfresults == None:
        try:
            sfresults = sf.query(sforg_query)
        except SalesforceExpiredSession:
            sf = refresh_token(request)
            sfresults = sf.query(sforg_query)
        cache.set('orgsearch-%s' % hashkey, sfresults, 30)

    records = sfresults['records']

    result = {}
    for x in records:
        result.update({x['Id']: x['Name']})

    return HttpResponse(json.dumps(result), content_type="application/json")
开发者ID:erwinjulius,项目名称:actforce,代码行数:34,代码来源:salesforce.py

示例4: query_salesforce

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
def query_salesforce(arg: str, salesforce: simple_salesforce.Salesforce, command: Dict[str, Any]) -> str:
    arg = arg.strip()
    qarg = arg.split(' -', 1)[0]
    split_args = []  # type: List[str]
    raw_arg = ''
    if len(arg.split(' -', 1)) > 1:
        raw_arg = ' -' + arg.split(' -', 1)[1]
        split_args = raw_arg.split(' -')
    limit_num = 5
    re_limit = re.compile('-limit \d+')
    limit = re_limit.search(raw_arg)
    if limit:
        limit_num = int(limit.group().rsplit(' ', 1)[1])
        logging.info('Searching with limit {}'.format(limit_num))
    query = default_query
    if 'query' in command.keys():
        query = command['query']
    object_type = object_types[command['object']]
    res = salesforce.query(query.format(
        object_type['fields'], object_type['table'], qarg, limit_num))
    exclude_keys = []  # type: List[str]
    if 'exclude_keys' in command.keys():
        exclude_keys = command['exclude_keys']
    force_keys = []  # type: List[str]
    if 'force_keys' in command.keys():
        force_keys = command['force_keys']
    rank_output = False
    if 'rank_output' in command.keys():
        rank_output = command['rank_output']
    show_all_keys = 'show' in split_args
    if 'show_all_keys' in command.keys():
        show_all_keys = command['show_all_keys'] or 'show' in split_args
    return format_result(res, exclude_keys=exclude_keys, force_keys=force_keys, rank_output=rank_output, show_all_keys=show_all_keys)
开发者ID:Juljan,项目名称:python-zulip-api,代码行数:35,代码来源:salesforce.py

示例5: main

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
def main():

    credentials = sfconf.credentials
    sf = Salesforce(username = credentials['username'], password = credentials['password'],\
                                 security_token = credentials['security_token'])


    sales_managers_profile_id = '00eb0000000YXJL'
    users = sf.query('SELECT Id, Name FROM User WHERE profileid = \'%s\' AND isActive = true ' % sales_managers_profile_id)

    active_users = []
    users = users['records']

    for user in users:
        active_users.append(str(user['Id']))

    active_users = str(active_users).replace('[','(').replace(']',')')

    funding_by_users_query = "SELECT AccountId__r.ownerid, sum(amount__c) FROM AForexEvent__c WHERE EventType__c = 'funding' \
                              AND DateTimeOfEvent__c = THIS_MONTH AND AccountId__r.ownerid in %s GROUP BY ROLLUP(AccountId__r.ownerid)"

    withdrawal_by_users_query = "SELECT AccountId__r.ownerid, sum(amount__c) FROM AForexEvent__c WHERE EventType__c = 'Withdrawal' \
                                 AND DateTimeOfEvent__c = THIS_MONTH AND AccountId__r.ownerid in %s GROUP BY ROLLUP(AccountId__r.ownerid)"

    converted_leads_by_users_query = "SELECT Account__r.ownerid, count(Incentive_Deposit_Amount__c) FROM  Wallet__c WHERE First_Funding_Date__c = THIS_MONTH \
                                      AND Incentive_Deposit_Amount__c > 95 AND Account__r.ownerid in %s GROUP BY ROLLUP(Account__r.ownerid)"

    sum_of_incentive_deposites_by_users_query = "SELECT Account__r.ownerid, sum(Incentive_Deposit_Amount__c) FROM  Wallet__c \
                                                 WHERE First_Funding_Date__c = THIS_MONTH AND Account__r.ownerid in %s GROUP BY ROLLUP(Account__r.ownerid)"


    outbount_calls_to_accounts_by_users_query = "SELECT OwnerId, Count(Id)From Task WHERE \
     (Who.Type in ('Account', 'Contact') OR What.Type in ('Account', 'Contact')) \
     AND type = 'Outbound Call'  \
     AND result__c in ('1 Talked - Substantial', '2 Talked - Brief', '3 Talked - Callback Requested', '4 Reached Associate') \
     AND status = 'Завершено' \
     AND ActivityDate = THIS_MONTH \
     AND OwnerId in %s \
     GROUP BY ROLLUP(OwnerId)"

    outbount_calls_to_leads_by_users_query = "SELECT OwnerId, Count(Id)From Task WHERE \
     (Who.Type in ('Lead') OR What.Type in ('Lead')) \
     AND type = 'Outbound Call'  \
     AND result__c in ('1 Talked - Substantial', '2 Talked - Brief', '3 Talked - Callback Requested', '4 Reached Associate') \
     AND status = 'Завершено' \
     AND ActivityDate = THIS_MONTH \
     AND OwnerId in %s \
     GROUP BY ROLLUP(OwnerId)"

    funding_by_users, funding_user_names = Dashboard(active_users, funding_by_users_query).get_salesforce_data()
    withdrawal_by_users, withdrawal_user_names = Dashboard(active_users, withdrawal_by_users_query).get_salesforce_data()
    converted_leads_by_users, converted_leads_user_names = Dashboard(active_users, converted_leads_by_users_query).get_salesforce_data()
    sum_of_incentive_deposites_by_users,  sum_of_incentive_user_names = Dashboard(active_users, sum_of_incentive_deposites_by_users_query).get_salesforce_data()
    outbount_calls_to_accounts_by_users, outbount_calls_to_accounts_user_names = Dashboard(active_users, outbount_calls_to_accounts_by_users_query).get_salesforce_data()
    outbount_calls_to_leads_by_users, outbount_calls_to_leads_user_names = Dashboard(active_users, outbount_calls_to_leads_by_users_query).get_salesforce_data()

    return funding_by_users, funding_user_names, withdrawal_by_users, withdrawal_user_names, \
           converted_leads_by_users, converted_leads_user_names, sum_of_incentive_deposites_by_users,  sum_of_incentive_user_names, \
           outbount_calls_to_accounts_by_users, outbount_calls_to_accounts_user_names, \
           outbount_calls_to_leads_by_users, outbount_calls_to_leads_user_names
开发者ID:SergeyLatsarus,项目名称:AsteriskStat,代码行数:62,代码来源:salesforce_dashboard.py

示例6: count_records

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
def count_records(program):
    query = translate_program_to_soql(program, count_only=True)

    # fetch count
    program.source.token.refresh()  # TODO: Source.count_records
    conn = Salesforce(session_id=program.source.token.access_token,
                      instance_url=program.source.token.instance_url,
                      sandbox=program.source.token.is_sandbox)

    try:
        count = conn.query(query)['totalSize']
    except SalesforceError as e:
        raise Exception({
            'type': 'salesforceerror',
            'data': e.content[0],
        })
    except RequestException:
        raise Exception({
            'type': 'connectionerror',
        })
    except:
        raise Exception({
            'type': 'unknown',
        })
    else:
        return count
开发者ID:john2world,项目名称:Ring1leads,代码行数:28,代码来源:utils.py

示例7: get_pricebooks

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
def get_pricebooks():
    sf = Salesforce(instance_url=settings.SALESFORCE_URL,
                    username=settings.SALESFORCE_USERNAME,
                    password=settings.SALESFORCE_PASSWORD,
                    security_token=settings.SALESFORCE_TOKEN)

    pricebooks = PriceBook.objects.all()
    for pb in pricebooks:
        pricebook = sf.Pricebook2.get(pb.identifier)
        query = ("SELECT Id,Name,ProductCode,UnitPrice,IsActive FROM PricebookEntry "
                 "WHERE Pricebook2Id = '{}'").format(pb.identifier)
        remote_prices = sf.query(query)

        price_list, created = PriceBook.objects.get_or_create(name=pricebook['Name'])

        for item in remote_prices['records']:
            price, created = Price.objects.get_or_create(code=item['ProductCode'],
                                                         defaults={
                'name': item['Name'],
                'price': item['UnitPrice'],
                'identifier': item['Id']
            })
            price.name = item['Name']
            price.price = item['UnitPrice']
            price.identifier = item['Id']
            price.save()

            price_list.prices.add(price)
开发者ID:GETLIMS,项目名称:LIMS-Backend,代码行数:30,代码来源:getpricebooks.py

示例8: setup

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
def setup():
	#
	# Declare global variables
	#
	global myRegId
	global myUsername
	global myPassword
	global myToken
	global contactid
	global subject
	global ws
	global adxl

	#
	# setup Raspberry Pi ADXL345
	# see http://shop.pimoroni.com/products/adafruit-triple-axis-accelerometer
	#
	if not simulation_mode:
		adxl = adxl345.ADXL345()
		#adxl.setRange(adxl345.RANGE_2G)
		adxl.setRange(adxl345.RANGE_16G)

	#
	# Read configuration from file
	#
	config = ConfigParser.RawConfigParser()
	config.read('salesforce_login.cfg')

	#
	# Establish Websockt connection for monitoring chat service
	#
	if chat_mode:
		ws_url = config.get('Chat', 'ws_url')
		ws = create_connection(ws_url)


	#
	# Lookup Salesforce demo org credentials and configuration
	#
	sf_lookup = Salesforce(username=config.get('Salesforce', 'username'), password=config.get('Salesforce', 'password'), security_token=config.get('Salesforce', 'security_token'))
	result = sf_lookup.query("SELECT Id, Username__c, Password__c, Security_Token__c, Case_Contact_Id__c, Case_Subject__c FROM Raspberry_Pi_Demo__c WHERE Active__c = true AND Raspi_Hostname__c = " + config.get('Host', 'hostname'))

	#
	# Register new demo run
	#
	myRegId = result.get('records')[0].get('Id')	
	sf_lookup.Raspberry_Pi_Demo_Registration__c.create({'Raspberry_Pi_Demo__c':myRegId,'Status__c':'connected'})

	myUsername = result.get('records')[0].get('Username__c')
	myPassword =  result.get('records')[0].get('Password__c')
	myToken = result.get('records')[0].get('Security_Token__c')

	contactid = result.get('records')[0].get('Case_Contact_Id__c')
	subject = result.get('records')[0].get('Case_Subject__c')

	if chat_mode:
		chat("Sensor","Connection established.")
开发者ID:tegeling,项目名称:raspiforce,代码行数:59,代码来源:tennis.py

示例9: application

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
def application(caseid):
    if caseid in kvs:
        url = sf_url + '/console#%2f' + kvs[caseid]
    else:
        sf = Salesforce(instance_url=sf_url, username=sf_usr, password=sf_pwd, security_token=sf_tkn)
        for case in sf.query("SELECT Id from Case where CaseNumber = '%d'" % int(caseid))['records']:
          kvs[caseid] = case['Id']
          url = sf_url + '/console#%2f' + case['Id']
    return redirect(url, code=301)
开发者ID:dinobot,项目名称:duty-reports,代码行数:11,代码来源:http_redirect.py

示例10: get_oauth_user

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
def get_oauth_user(oauth):
    """ Fetches the user info from the org """
    if not oauth or not oauth.get('access_token', None):
        return 'Not connected'
    sf = Salesforce(instance_url = oauth['instance_url'], session_id = oauth['access_token'], sandbox = oauth.get('sandbox',False))
    # Parse user id from id which ends in /ORGID/USERID
    user_id = oauth['id'].split('/')[-1]

    #user = sf.User.get(user_id)
    res = sf.query("SELECT Id, Username, Profile.PermissionsModifyAllData from User WHERE Id='%s'" % user_id)
    user = res['records'][0];
    return user
开发者ID:donaldrivard,项目名称:mrbelvedere,代码行数:14,代码来源:views.py

示例11: application

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
def application():
    caseid = request.args.get('text', '')
    if caseid in kvs:
        url = sf_url + '/console#%2f' + kvs[caseid].get('id')
        title = kvs[caseid].get('title')
    else:
        sf = Salesforce(instance_url=sf_url, username=sf_usr, password=sf_pwd, security_token=sf_tkn)
        for case in sf.query("SELECT Id, Subject from Case where CaseNumber = '%d'" % int(caseid))['records']:
          kvs[caseid] = {'id': case['Id'], 'title': prepare_json_data(case['Subject'])}
          url = sf_url + '/console#%2f' + case['Id']
          title = prepare_json_data(case['Subject'])
    return '{"response_type": "in_channel", "attachments": [{"title": "'+title+'","title_link": "'+url+'",}]}', 200, {'Content-Type': 'application/json'}
开发者ID:dinobot,项目名称:duty-reports,代码行数:14,代码来源:case_handle.py

示例12: salesforceUpload

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
	def salesforceUpload(self,information):
		# we are making safe connection with salesforce by passing account information
		sf = Salesforce(username=information['salesforceUserName'], password=information['salesforcepassword'], security_token=information['salesforcesecurityToken'])
		# we are getting session id here
		sessionId = sf.session_id
	
		flag = 0
		# we are querying all folders in your salesforce account
		documentQuery = sf.query("SELECT ID,Name FROM folder")
		# we are traversing all folders and fetching the folderid for our target folder which is SpringCM
		for f in documentQuery['records']:
			if (information['targetFoldername'] == f['Name']):
				folderid = f['Id']
				flag = 1
				print "folder found"
				break

		if flag ==0:
			loggerFile.write("Module salesforceUpload:folder not found")
			loggerFile.write("\n")
			print "folder not found"
			print "Leaving this program"
			return 0
		body = ""
		# here we are opening our xml file and encoding into base4..this is required to send files to salesforce
		with open(information['filename'], "r") as f:
			body = base64.b64encode(f.read())

		# Rest API post method call.. using requests post method
		# here we are sending parameters:
		#first one is url
		#second one is header, with content type as json
		#third one is our actual data
		response = requests.post('https://%s.salesforce.com/services/data/v24.0/sobjects/Document/' % information['salesforceinstance'],
		    headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer %s' % sessionId },
		    data = json.dumps({
				'FolderId':folderid,
			'Name': information['filename'],
			'body': body
		    })
		)
		#printing the response output
		print response.text
		json_data = json.loads(response.text)
		if(json_data['success']== True):
			return 1
		else:
			loggerFile.write("Module salesforceUpload:Upload Failed")
			loggerFile.write("\n")
			return 0
开发者ID:gkhandelwal,项目名称:ftp2Salesforce,代码行数:52,代码来源:ftpSalesforce.py

示例13: statuscheck

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
def statuscheck():
    global done
    uname = input(str("Enter Username: "))
    pword = input(str("Enter password: "))
    key = input(str("Enter API key: "))
    sf=Salesforce(username=uname, password=pword, security_token=key)
    cid_ask = input(str("Enter Case Number to get Status: " ))
    try:
        a=sf.query("SELECT Status, Owner.Name FROM case where CaseNumber = '{0}'".format(cid_ask))
        status = a['records'][0]['Status']
        owner = a['records'][0]['Owner']['Name']
        print("Case {0} is owned by {1} and is in status {2}".format(cid_ask, owner, status))
        done = True
    except:
        print("The case number you have entered is invalid.")
开发者ID:rhquant,项目名称:Travis,代码行数:17,代码来源:OpenCase.py

示例14: SF

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
class SF(Resource):
    def __init__(self):
        self.sf = Salesforce(
            username=os.environ.get('SF_USER'),
            password=os.environ.get('SF_PASS'),
            security_token=os.environ.get('SF_TOKEN'),
            sandbox=True)
        return

    def get_team(self):
        dict = self.sf.query("SELECT Username, Title, FirstName, LastName, MobilePhone, Email, City "
                        "FROM User WHERE "
                        "(Title = 'Developer Evangelist' "
                        "OR Title = 'Community Guy' "
                        "OR Title = 'Developer Communications Director') "
                        "AND IsActive = True")
        team_items = {}
        team = []
        ret = "Team Size: " + str(dict[u'totalSize']) + " "
        for i in range(dict[u'totalSize']):
            dict2 = dict[u'records'][i]
            # This is unique and in the form of an email, this will be our ID
            team_items['ID'] = str(dict2[u'Username'])
            team_items['Type'] = str(dict2[u'Title'])
            team_items['FirstName'] = str(dict2[u'FirstName'])
            team_items['LastName'] = str(dict2[u'LastName'])
            # There is also the option to get the SendGrid landline phone + Extension
            # TODO: get rid of the string conversion and make sure this value exists for all team members
            team_items['Phone'] = str(dict2[u'MobilePhone'])
            team_items['Email'] = str(dict2[u'Email'])
            # TODO: get rid of the string conversion and make sure this value exists for all team members
            team_items['HomeCity'] = str(dict2[u'City'])
            team.append(team_items)
            team_items={}
        return team

    def put_relationship(self):
        return self.sf.Lead.create({
            'FirstName':'Testy',
            'LastName':'McTesterton',
            'Company':'SendGrid',
            'Monthly_Email_Volume__c':'2.5M to 10M',
            'Type__c':'Reseller',
            'Status':'Existing Customer',
            'LeadSource':'Corporate Event',
            'Developer_Relations_Rep__c':'[email protected]'
        })
开发者ID:thinkingserious,项目名称:sendgrid-devrel-api,代码行数:49,代码来源:salesforce.py

示例15: post

# 需要导入模块: from simple_salesforce import Salesforce [as 别名]
# 或者: from simple_salesforce.Salesforce import query [as 别名]
    def post(self, request, format=None):
        if settings.ENABLE_CRM:
            crm_project_ids = request.data.get('crm_ids', None)

            if crm_project_ids:
                projects = CRMProject.objects.filter(id__in=crm_project_ids)

                crm_identifiers = ["'" + p.project_identifier + "'" for p in projects.all()]

                sf = Salesforce(instance_url=settings.SALESFORCE_URL,
                                username=settings.SALESFORCE_USERNAME,
                                password=settings.SALESFORCE_PASSWORD,
                                security_token=settings.SALESFORCE_TOKEN)
                crm_project_query = ("SELECT o.Id,o.Name,o.Description,o.CreatedDate,"
                                     "o.Project_Status__c "
                                     "FROM Opportunity o "
                                     "WHERE o.Id IN ({})").format(", ".join(crm_identifiers))
                crm_project_data = sf.query(crm_project_query)
                if crm_project_data['totalSize'] > 0:
                    records = crm_project_data['records']
                    for record in records:
                        try:
                            proj = CRMProject.objects.get(project_identifier=record['Id'])
                        except:
                            pass
                        else:
                            proj.name = record['Name']
                            proj.description = record['Description']
                            proj.status = record.get('Project_Status__c', '')
                            proj.save()
                            # Get project and update status
                            projects = proj.project_set.all()
                            for p in projects:
                                if record.get('Project_Status__c', '') != '':
                                    ps = record.get('Project_Status__c')
                                    try:
                                        project_status = ProjectStatus.objects.get(name=ps)
                                    except ObjectDoesNotExist:
                                        project_status = ProjectStatus.objects.create(name=ps)
                                    p.status = project_status
                                    p.save()
                    return Response({'message': 'Projects updated'})
                return Response({'message': 'No projects found on CRM system'}, status=404)
            return Response({'message': 'Please provide a list of CRM project IDs'}, status=400)
        return Response({'message': 'CRM is currently disabled'}, status=501)
开发者ID:GETLIMS,项目名称:LIMS-Backend,代码行数:47,代码来源:views.py


注:本文中的simple_salesforce.Salesforce.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。