Synchronous Updates not working...exception

Dec 27, 2012 at 1:32 PM

I have set up a new slam table to use synchronous updates. When i run the sync on the control panel, it syncs fine. However when I add a new item to the sharepoint list, i get the following exception.

Slam.Exceptions.SlamException: ID for item, View/Edit Bid Job, not found. at Slam.SharePoint.DefaultListItemExtensions.GetUniqueId(SPListItem listItem, Boolean generateNewIdIfNull, Boolean throwExceptionIfNull) at Slam.SharePoint.SPListItemExtender.GetUniqueId(SPListItem listItem) at Slam.Events.DefaultEvents.Create(SPListItem listItem, IDataServices dataServices, IConfigurationManager configuration, ILogger logger, String eventPrefix)

I have "View/Edit Bid Job" set up as the default title for all of my items so I can use that built in title link to view the item.  I don't understand why I am getting this exception.

Another weird thing is that the control panel sync wouldn't work until I went into SQL and took the primary key off the table and allowed nulls in the id fields.  When I run it from the control panel, it inserts everying into SQL fine, but it through an error until i made those sql chanages.  Any idea why these things are happening?  I'm new to slam, but I have gotten it to work fine until this.

Thanks in advance for the help!

Confing File:

<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
 <ConnectionStrings Default="SLAM">
  <add Name="SLAM" ConnectionString="Database=SP_BidJobDB;Data Source=mydatasource;User Id=userid;Password=password" />
 </ConnectionStrings>

 <TypeIdDefinitions>
  <add Name="Global" SqlType="varchar(25)" IsPrimaryKey="true" NameFormat="{TableName}ID" ValueFormat="Hex" ReplaceSharePointIds="true" />
  <add Name="GlobalWithSharePointIDs" SqlType="varchar(25)" IsPrimaryKey="true" NameFormat="{TableName}ID" ValueFormat="Hex" ReplaceSharePointIds="false" />
 </TypeIdDefinitions>
 
 <DataMapping  DataSchema="SLAM" TypeIdDefinition="Global" SynchronousUpdates="true" SiteCollection="sites/bidjob">
  <List  Name="Bid Jobs" ActivationOrder="1">
   <Fields>
    <Field Name="Client" SqlType="varchar(255)" SPType="Text" Required="false"></Field>
    <Field Name="Company" SqlType="varchar(255)" SPType="Text" Required="true"></Field>
    <Field Name="Customer Name" SqlType="varchar(255)" SPType="Text" Required="false"></Field>
    <Field Name="Title" SqlType="varchar(255)" SPType="Text" Required="false"></Field>
   </Fields>
  </List>

 </DataMapping>
</Configuration>

Developer
Dec 27, 2012 at 4:33 PM

Your problem is actually related to the addition of the TypeIdDefinitions section.  It sounds like you wanted to leave items in the database keying on ListItemID.  If you wanted to begin using the SLAM ID field for your items then to work out your current issue I would say to delete your BidJobs table and re-activate SLAM.  If it isn't already there that would add the SLAM ID field to your list.  On synch or saving the existing items will be issued SLAM IDs and in the database you would see a primary key column BidJobsID containing those IDs.

Dec 27, 2012 at 5:44 PM

Thanks so much for your reply. 

So I did activate SLAM on this site collection after the list was already created, I don't care what the database is keyed on really.  Is there any way to get the synchronous updates to start working with deleting that list?  I have done a bunch of work to its inforpath form already.

Developer
Dec 27, 2012 at 5:45 PM

You do not need to delete the list.  I was suggesting you delete the database table so it would be rebuilt correctly.  The list and items can stay as is.

Dec 27, 2012 at 7:01 PM

Thanks. I really appreciate your help, I really have no clue why this is messing up.

I deleted the SQL table and clicked Activate again in the SLAM control  panel. It recreated the table fine, but I am still getting the same error:

Slam.Exceptions.SlamException: ID for item, View/Edit Bid Job, not found. at Slam.SharePoint.DefaultListItemExtensions.GetUniqueId(SPListItem listItem, Boolean generateNewIdIfNull, Boolean throwExceptionIfNull) at  Slam.SharePoint.SPListItemExtender.GetUniqueId(SPListItem listItem) at Slam.Events.DefaultEvents.Create(SPListItem listItem, IDataServices dataServices, IConfigurationManager configuration, ILogger logger, String eventPrefix)

When I click they sync button on the control panel it all snycs fine. I don see a BidJobsID field and a List ID field in the SQL table along with the fields I defined in the config, and the are all populated when I do a full sync from the control panel,but when I just save a new item to the list, nothing is added to the SQL table and that error shows up on the diagnostics screen.

I also tested, if I update an item in the list that has been sync'd over with a full sync and save the item in the list, it does automatically update in SQL.

So all that is apparently not working is for a new item saved in the list to be automatically SLAM'D to SQL.

Do you have anything else for me to try?  

Developer
Dec 27, 2012 at 7:09 PM

So when you add a new item, it apparently is not getting a SLAM ID.  If you save it again do you get the same error?  And if you sync again with the the new item does it actually slam?

 

What kind of list is it?  Custom list or document library of some kind?

Dec 27, 2012 at 7:14 PM

Yes, if you save it and then go to edit and save the item again you see that error twice. If you sync from the control panel, the new item slams fine, but if you just add a new item and click save from the list, it doesn't slam.

It is just a custom list.  Nothing really special about it that I know of.

Developer
Dec 27, 2012 at 7:20 PM

If you go to list settings for the list, do you see SLAM ID in the list of columns?  And if you have content types enabled on the list, is it assigned to item content type you're trying to create?

Dec 27, 2012 at 7:45 PM

Yes, I see SLAMID in the columns list and I don't have content types enabled.

Dec 28, 2012 at 6:17 PM

Ok I think I may have realized what the problem is and I need to know if I'm correct and if there is a workaround.

As I said before, I had done some heavy modification on the InfoPath form for the list I was having the problem with. I realized that SlamID wasn't available in InfoPath, so I was wondering if that was causing the problem. So I went to an old test that that was working perfectly with SLAM, and modified the InfoPath form...and when I opened the formed I got a message saying SLAMID wouldn't be available in InfoPath due to the field type. So then, I uploaded the InfoPath form and from that point, I started receiving the same error message as I was getting on the first list that the ID couldn't be found. So it seems like if you modify and upload the InfoPath form for a list, it can't create the slam id.

Have you seen this before and is there a way to get the synchronous slam to work if I modify the InfoPath form? 

Thanks so much!

Jan 2, 2013 at 2:07 PM

Any help on this would be very appreciated.  Thanks!

Jan 7, 2013 at 7:54 PM

Anything?  I would love some advice on this issue if anyone has any?

Jan 9, 2013 at 3:58 PM

I have also verified that if you try to chage the list newform.aspx in Sharepoint Designer and save and try to add, you see the same issue, however if you undo the changes to the aspx page and save and try again, it starts the automatic slamming again.  So anything you chagne the forms the SLAM ID is not getting set.  How is that value set on the forms?  Please help.

Developer
Jan 9, 2013 at 4:02 PM

That probably depends on what changes you made to the newform.  The SLAM ID is just a custom field type.  It generates an ID on load of the form (so it has a value before the item is saved).

Jan 9, 2013 at 4:09 PM

Well I know if I change the form in Infopath, even if I open the form and save with no changes, it causes this problem.  It seems like this is likely because at that point is is using an xsn form file instead of an ASPX file. 

I need to customize this form quite a bit, mainly just formatting, but I tried to just edit the newform by going to the ribbon and doing insert New Item Form for the test list that I am working with and saving.  I didn't make any other changes to the form and it still caused the issue.

It's like any change to the form causes that that ID not to generate.

Do you have any ideas I could try to ensure that ID is generated?

I realize that this is a free solution, so I really apprieciate your assitance with this.  I think it's such a cool solution, I would really like to be able to utilize it with this project.