Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
6432 Ansichten

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')})
Avatar
Verwerfen

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

Beste Antwort

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

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Aug. 22
2169
7
Mai 22
25039
0
Apr. 22
2924
1
Sept. 16
5569
0
Juli 16
3997