Pergunta

Eu tenho um problema, com este evento. Qual é o meu propósito: Eu quero atualizar uma das propriedades com base em alguns critérios, então eu quero preencher um campo A se o campo A estiver vazio e o campo B não estiver vazio e o campo C também não está vazio.

Como fazê-lo corretamente porque, com o itemUpdating algumas pós-properties, às vezes são nulos ou não existem em tudo etc etc.

qualquer bom conselho?

Só para que você saiba que é sobre sharepoint 2007

update : o problema é que eu preciso comparar se o valor anterior e o novo valor: por isso, se alguém atualizar um item.

ex: Item atual: title= value1; title2= value1

Alguém atualiza em conformidade: title= newValue O item atualizado deve ter o seguinte valor: Título= NewValue; title2= newValue

próxima vez após a atualização: title2= againanewvalue;

Item atualizado deve ser como Firlwoing: title= againanewvalue; title2= againanewvalue;

Então, basicamente, ambos os campos devem permanecer sincronizados da NNO qual é atualizado, então não consigo saber qual dos campos foi atualizado e, em seguida, qual eu devo atualizar ..

você vê

Foi útil?

Solução 3

Basically at the end I solved my issue myself.

Just by checking the listItem.AfterProperties["column"] and comparing them with ListItem["column"] and then setting the again to ListItem.AfterProperties["column"]= value;

Outras dicas

Just one question: Is there a reason for not using ItemUpdated where all your field would have been updated with the fresh information?

In ItemAdding you must check both BeforeProperties and AfterProperties to be successful in this task.

In ItemAdded:

title2 = title

In ItemUpdated workflow:

//Only when there is a change in title/title2 columns
if(title != title2)
{
    //Meaning title has changed
    if(title.beforeProperties.Value ==  title2)
    {
         title2 = title
    }
    //Meaning title2 has changed
    else if(title2.beforeProperties.Value ==  title)
    {
         title = title2
    }
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange
scroll top