Form Policy getting error

Hi, I have return a custom action for storing the name, mobile and email in google sheets. but bot get struck after giving the email id. please help for this issue.

class StoreForm(FormAction): “”“Collects sales information and adds it to the spreadsheet”""

def name(self):
    return "store_form"

def required_slots(tracker):
    return [

def slot_mappings(self):
    # type: () -> Dict[Text: Union[Dict, List[Dict]]]
    """A dictionary to map required slots to
        - an extracted entity
        - intent: value pairs
        - a whole message
        or a list of them, where a first match will be picked"""

    return {
        "PERSON": [
       "mobile": [
        "business_email": [

def validate_business_business_email(self, value, dispatcher, tracker, domain):
    """Check to see if an business_email entity was actually picked up by duckling."""

    if any(tracker.get_latest_entity_values("business_email")):
        # entity was picked up, validate slot
        return {"business_email": value}
        # no entity was picked up, we want to ask again
        dispatcher.utter_template("utter_no_business_email", tracker)
        return {"business_email": None}

def submit(
    dispatcher: CollectingDispatcher,
    tracker: Tracker,
    domain: Dict[Text, Any],
) -> List[Dict]:
    """Once we have all the information, attempt to add it to the
    Google Drive database"""

    import datetime

    business_email = tracker.get_slot("business_email")
    PERSON = tracker.get_slot("PERSON")
    mobile = tracker.get_slot("mobile")
    date ="%d/%m/%Y")

    sales_info = [mobile, date, PERSON, business_email]

        gdrive = GDriveService()
        dispatcher.utter_template("utter_confirm_salesrequest", tracker)
        return []
    except Exception as e:
            "Failed to write data to gdocs. Error: {}" "".format(e.message),
        dispatcher.utter_template("utter_salesrequest_failed", tracker)
        return []

out1.txt (24.5 KB)

i have seen that slot are not filled with values

domain.yml image

Hmm, from looking through the log it looks like the missing slots are due to different things.

The mobile number isn’t being recognised as an entity:

Received user message ‘8789855555’ with intent ‘{‘name’: ‘mobile’, ‘confidence’: 0.7166034579277039}’ and entities ‘[]’

And the entity you’re asking for in the slot_mappings is “name”, but the one that’s being identified by the entity recogniser is “person_name”:

Received user message ‘karthik’ with intent ‘{‘name’: ‘PERSON’, ‘confidence’: 0.9646666049957275}’ and entities ‘[{‘start’: 0, ‘end’: 7, ‘value’: ‘karthik’, ‘entity’: ‘person_name’, ‘confidence’: 0.7325764229592748, ‘extractor’: ‘CRFEntityExtractor’}]’

Hi sorry for the delay. Now custom actions working fine slot. Thank you for helping

1 Like

Glad to hear you got it working! :grin: