Having trouble writing data to data store entity

Hi all,

 

I am a beginner in Appian and I have come across a problem that I've debugged for an hour but can't find the solution to. I'm attempting to write data to a data store entity and I continue to get the following error:

Problem:  An error occurred in executing an Activity Class.

Details:  An error occurred while trying to write to the entity "vehicle_parts" [id=7241da9e-15f3-402f-ae6d-b0f08195974e@87648, type=VFM_Part (id=3724)] (data store: VFM DS CK). Details: java.lang.IllegalArgumentException: The record to be saved must not be null: TypedValue[it=3724,v=<null>] Data: TypedValue[it=3724,v=<null>]

Recommended Action:  Examine the activity class to correct the error and then resume.

Priority of this problem: High Priority

 

Does anyone have any idea how to solve this? If it helps, I'm also having trouble finding the created table after I save and publish my data store with no issues.

  Discussion posts and replies are publicly visible

  • Do you have an on-premise database, or do you use phpMyAdmin through the Cloud?

    Regardless, I'd search through your tables for 'part' or 'vehicle, or otherwise just look at each table to identify it's present.
  • Can you please try searching for the table "vfmpart" in the database ? Since the table is not mapped and the CDT name is "VFM_Part" the table name should ideally be created as "vfmpart" by default

    Also please ensure that you are searching in the correct schema in the database.
  • You can also alternatively download the DDL script to find the table name from the above screen which you have attached

    It would also be helpful if you can please ensure that the process variable which is being referred in the "Write to Data Store" node is being properly populated

    Also please ensure that the primary key is either provided by you before writing to the database or is auto increment
  • Please create your CDT in this template with specifying proper table anme like: @Table(name="VFM_Vehicle"), Sample Snippet below:
    <xsd:schema xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:tns="urn:com:appian:types" targetNamespace="urn:com:appian:types">
    <xsd:complexType name="MMVFM_Vehicle">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">
    @Table(name="VFM_Vehicle")
    </xsd:appinfo>
    </xsd:annotation>

    <xsd:sequence>
    <xsd:element name="ID" nillable="true" type="xsd:int">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Id @GeneratedValue @Column(name="Id")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    <xsd:element name="requestID" nillable="true" type="xsd:int">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Column(name="REQUEST_ID")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    <xsd:element name="VIN" nillable="true" type="xsd:string">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Column(name="VIN", columnDefinition="VARCHAR(255) NOT NULL UNIQUE")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>
    </xsd:sequence>

    </xsd:complexType>
    </xsd:schema>
  • 0
    A Score Level 1
    in reply to mukeshm
    <xsd:schema xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:tns="urn:com:appian:types" targetNamespace="urn:com:appian:types">
    <xsd:complexType name="MMVFM_Vehicle">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">
    @Table(name="VFM_Vehicle")
    </xsd:appinfo>
    </xsd:annotation>

    <xsd:sequence>
    <xsd:element name="ID" nillable="true" type="xsd:int">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Id @GeneratedValue @Column(name="Id")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    <xsd:element name="requestID" nillable="true" type="xsd:int">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Column(name="REQUEST_ID")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    <xsd:element name="VIN" nillable="true" type="xsd:string">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Column(name="VIN", columnDefinition="VARCHAR(255) NOT NULL UNIQUE")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>
    </xsd:sequence>

    </xsd:complexType>
    </xsd:schema>
  • 0
    Certified Lead Developer
    As i can find lot of useful information's related to your query, so here i would like to add few more points into the consideration:

    1. As you did not define @Table annotation, hence the table will be created by the name, same as CDT, for example: VFM_Part => vfmpart
    2. You can open Data Store and Download the DDL script, and check for Create Script is targeting to which table
    3. you can cross check the schema name under ..../suite/admin/ url > Integration > Data Sources
    4. As per my understanding, (if these all configurations are correct then) You are using Write to Data Store Entity Smart Service for storing the data into the corresponding table, so basically the above exception can also be thrown when the row which we are trying to store contains null as it's value (doesn't matter whether the Primary is Auto Generate or not, but value to be inserted must not be null)
    5. If you want to avoid the above case, where there are some changes of empty row to be coming from Process/Interface then try using Write to Multiple Data Store Entity Node, this will avoid empty rows to be inserted into the DB


    I hope above points will you to debug the issue.
  • vfmpart is a part of the database and that is currently what my database is storing to and I'm not sure why. Unfortunately that is also another user in the databases's table so our information is currently merged. What step did I miss in mapping my table?
  • vfmpart is a part of the database and that is currently what my database is storing to and I'm not sure why. Unfortunately that is also another user in the databases's table so our information is currently merged. What step did I miss in mapping my table?
  • hi here is what the ddl script says
    /* UPDATE DDL */
    /* DROP AND CREATE DDL */
    /* WARNING: The DDL commented out below will drop and re-create all tables.
    drop table if exists `vfmpart`;

    create table `vfmpart` (
    `id` integer not null auto_increment,
    `name` varchar(255),
    `category` varchar(255),
    `manufacturer` varchar(255),
    `cost` double precision,
    primary key (`id`)
    ) ENGINE=InnoDB;
    */

    I'm not understanding why the table created was vfmpart? I think that's where I'm the most confused.
  • 0
    Certified Lead Developer
    in reply to ck0220
    Generally when we create a CDT, and if we don't define @Table Annotation in its XSD, then usually Appian will convert CDT name into small and removing special characters such as _ hence the table will be created by the name vfmpart while publishing the Data Store, that's why it's a best practice to define the Table name using Annotation in its XSD before publishing the Data Store.
    The reason behind by default name generation strategy is, Designer may or may not define the Annotation i.e. @Table in XSD file manually, then Appian must handle that scenario so that the Data Store should get published without any error, hence they define by default an alternate way.