コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
6295 ビュー

I'm using a web form that sends an email which is turned into a lead. The leads don't automatically parse the email and sort the name/phone/etc. into their corresponding fields. How can I use python to create an action server that does this?

I found a python example from another thread that doesn't seem to work so far:

def parse_description(description):
  '''
   there is parse function
   It is example for parsing messages like this:

   Name: John
   Phone: +100500
  '''
  fields=['Name','Phone']
  _dict={}
  description=description.lower()
  for line in description.split('\n'):
    for field in fields:
        if field in line:
            split_line=line.split(':')
            if len(split_line)>1:
                pre_dict[field]=line.split(':')[1]
  return  dict

lead=self.browse(cr,uid,context['active_id'],context=context)
description=lead['description']
_dict=parse_description(description)
self.write(cr,uid,context['active_id'],{
                        'partner_name':_dict.get('name'),
                        'contact_name':_dict.get('name'),
                        'phone':_dict.get(u'phone'),
                        'mobile':_dict.get(u'phone')})
アバター
破棄

Did you ever get an answer to this? I am having the same issue!

最善の回答

This does not work anymore (since 2013)
as email message is not passed into lead['description'] 

アバター
破棄
関連投稿 返信 ビュー 活動
0
8月 22
2030
7
5月 22
24864
0
4月 22
2770
1
9月 16
5469
0
7月 16
3857