Setting Filter on an Alert

Hi,
I am trying to create an alert programatically. When I set a CAML query as the filter condition, it always gives an error
The error message says -
The filter cannot be parsed. Check the filter syntax, and try again.
If I try to add an alert programattically without any filter conditions, I'm able to do so.
The strange part is that I have used the same CAML query to create a view programatically.
I am not able understand as to how a CAML query works with a view but not with an alert.
The CAML query is run on a list which has multiple choice columns.
The query contains multiple OR conditions to check against the values for those choice columns.
I have put in a query as -
<Where><Or><Eq><FieldRef Name='ItemType'/><Value Type='Choice'><Health></Value></Eq></Where>
Even this does not work....
I wanted to ask few questions -
Is there any specific rules we need to follow to set up the filters. What are the things that can go wrong when we set filters.
If the value of a choice field has special characters like () " , ! and so on, the query does not work when we try to fetch list items. What can be done to overcome this....
I have tried to enclose the values within the CDATA tag... It seems to work, but i am not very sure about it.
Please let me know if there is any other solution.
Thanks

Same problem and similar observations with no resolution. I believe this is a bug and we are working with Microsoft support to dig deeper into the issue.
To replicate (complete code provided below):
- Create a document library
- Create a choice column on the document library called "Category". This column has the values 1, 2, 3, 4. These choices are displayed as check boxes. 
- Programmatically create an alert on the document library (code below)
- Construct a CAML statement to assign to the alert object. This statement instructs the alert to send when a document is assigned a Category of 1 or 2. The CAML statement is below:
<Query><Or><Eq><FieldRef Name="Category" /><Value Type="Choice">1</Value></Eq><Eq><FieldRef Name="Category" /><Value Type="Choice">2</Value></Eq></Or></Query>
- Save the Alert
SharePoint is unable to parse the CAML and throws the following error:
System.Runtime.InteropServices.COMException (0x8102008F): The filter cannot be parsed. Check the filter syntax, and try again. at Microsoft.SharePoint.Library.SPRequestInternalClass.AddSubscription(String bstrUrl, String bstrListName, String bstrListID, Boolean bListItem, UInt32 ulItemId, String bstrItemDocUrl, Int32 lEventType, Int32 lNotifyFreq, DateTime notifyTime, Int32 lStatus, Boolean bSiteAdmin, String bstrAlertTitle, Int32 lAlertType, String strAlertTemplateName, String bstrFilter, String bstrProperties, Boolean bSendMail, Int32 lUserID) at Microsoft.SharePoint.Library.SPRequest.AddSubscription(String bstrUrl, String bstrListName, String bstrListID, Boolean bListItem, UInt32 ulItemId, String bstrItemDocUrl, Int32 lEventType, Int32 lNotifyFreq, DateTime notifyTime, Int32 lStatus, Boolean bSiteAdmin, String bstrAlertTitle, Int32 lAlertType, String strAlertTemplateName, String bstrFilter, String bstrProperties, Boolean bSendMail, Int32 lUserID)
If I change the value type from "Choice" to "Text" SharePoint will accept the CAML and execution completes correctly, however the CAML is not honoured.For example, alerts are sent not only for documents assigned a Category 1 or 2 but also documents that only have category 3 or 4 assigned (???).
Full code to replicate:
WindowsImpersonationContext wic = WindowsIdentity.GetCurrent().Impersonate();
        try
            using (SPSite GMS = new SPSite("http://sharepointdev:31626"))
                using (SPWeb GMSWeb = GMS.OpenWeb(SPContext.Current.Web.ID))
                    string doclibname = "StrippedDown";
                    SPList list = GMSWeb.Lists[doclibname];
                    SPAlert alert = GMSWeb.Alerts.Add();
                    alert.EventType = SPEventType.Modify;
                    alert.User = GMSWeb.CurrentUser;
                    alert.AlertType = SPAlertType.List;
                    alert.List = GMSWeb.Lists[doclibname];
                    alert.Title = doclibname + "_" + GMSWeb.CurrentUser.Name;
                    alert.AlertFrequency = SPAlertFrequency.Immediate;
                    alert.Filter = "<Query><Or><Eq><FieldRef Name=\"Category\" /><Value Type=\"Choice\">1</Value></Eq><Eq><FieldRef Name=\"Category\" /><Value Type=\"Choice\">2</Value></Eq></Or></Query>";
                    alert.Update();
                    alert = null;
            lblMsgs.Text = "Your subscription was successfully updated.";
        catch (Exception ex)
            lblMsgs.Text = "An error occured during creating your subscription. Please try again .The error text is <br><br>" + ex.InnerException.ToString();
        finally
            lblMsgs.Visible = true;
            wic.Undo();
            wic = null;

Similar Messages

  • How to set filter for few Setup Objects on Geneneral Foundation?

    Controlling the download of sub-entities:
    By default all sub-entities are downloaded. Pass a non-existing value
    for the parameter (primary key) of the sub-entity if you don't want to
    download a specific sub-entity.
    For example, if you don't want to download the values of a value set,
    then use following input to FLEX_VALUE attribute while setting filter;
    FLEX_VALUE='THIS_IS_A_NON_EXISTING_VALUE_I_DONT_WANT_TO_DOWNLOAD_VALUES'
    VALUE_SET
    Notes:
    - To download '$FLEX$.%' value sets pass '$FLEX$.%' argument.
    - Upload API automatically submits the hierarchy compiler request
    - FLEX_VALUE_SET_NAME is a required argument for download.
    You can find the following parameters in Set Filter screen of Value Set Values.
    VALUE_SET has subenities such as VSET_SECURITY_RULE, VSET_ROLLUP_GROUP and VSET_VALUE.
    Setting value for attribute FLEX_VALUE_SET_NAME downloads all the subentities. If you want
    to restrict the subentities, set appropriate filter at VSET_SECURITY_RULE, VSET_ROLLUP_GROUP
    and VSET_VALUE.
    Parameters:
    VALUE_SET
    | FLEX_VALUE_SET_NAME : Value set name.
    |
    +-VSET_SECURITY_RULE
    | FLEX_VALUE_RULE_NAME : Value set security rule name.
    | PARENT_FLEX_VALUE_LOW : Independent value for the dependent value sets.
    |
    +-VSET_ROLLUP_GROUP
    | HIERARCHY_CODE : Hierarchy (rollup group) code.
    |
    +-VSET_VALUE
    PARENT_FLEX_VALUE_LOW : Independent value for the dependent value sets.
    FLEX_VALUE : Flexfield segment value.
    DESC_FLEX
    Notes:
    - Upload API automatically submits the flexfield compiler request
    - Upload API automatically submits the DFV view generator request
    - APPLICATION_SHORT_NAME is a required argument for download.
    You can find the following parameters in Set Filter screen of Descriptive Flexfields.
    DESC_FLEX has subenities such as DFF_REF_FIELD, DFF_CONTEXT and DFF_SEGMENT.
    Setting value for attributes DESC_FLEX and DESCRIPTIVE_FLEXFIELD_NAME downloads all the subentities.
    If you want to restrict the subentities, set appropriate filter at DFF_REF_FIELD, DFF_CONTEXT
    and DFF_SEGMENT.
    Parameters:
    DESC_FLEX
    | APPLICATION_SHORT_NAME : Application Short Name.
    | DESCRIPTIVE_FLEXFIELD_NAME : Descriptive Flexfield Name.
    |
    +-DFF_REF_FIELD
    | DEFAULT_CONTEXT_FIELD_NAME : BLOCK.FIELD reference field name.
    |
    +-DFF_CONTEXT
    | DESCRIPTIVE_FLEX_CONTEXT_CODE : Context Code
    |
    +-DFF_SEGMENT
    END_USER_COLUMN_NAME : Segment Name
    APPLICATION_COLUMN_NAME : Column Name
    KEY_FLEX
    Notes:
    - Upload API automatically submits the flexfield compiler request
    - Upload API automatically submits the KFV view generator request
    - Upload API automatically submits the structure view generator request
    - APPLICATION_SHORT_NAME is a required argument for download.
    You can find the following parameters in Set Filter screen of Key Flexfields.
    KEY_FLEX has subenities such as DFF_REF_FIELD, DFF_CONTEXT and DFF_SEGMENT.
    Setting value for attributes APPLICATION_SHORT_NAME and ID_FLEX_CODE downloads all the subentities.
    If you want to restrict the subentities, set appropriate filter at KFF_FLEX_QUAL, KFF_SEGMENT_QUAL,
    ,KFF_STRUCTURE,KFF_WF_PROCESS,KFF_SH_ALIAS,KFF_CVR_RULE and KFF_SEGMENT.
    Parameters:
    KEY_FLEX
    | APPLICATION_SHORT_NAME : Application Short Name.
    | ID_FLEX_CODE : Key Flexfield Code.
    |
    +-KFF_FLEX_QUAL
    | | SEGMENT_ATTRIBUTE_TYPE : Flexfield Qualifier Name
    | |
    | +-KFF_SEGMENT_QUAL
    | VALUE_ATTRIBUTE_TYPE : Segment Qualifier Name
    |
    +-KFF_STRUCTURE
    | ID_FLEX_STRUCTURE_CODE : Structure Code
    |
    +-KFF_WF_PROCESS
    | WF_ITEM_TYPE : Workflow Item Type
    |
    +-KFF_SH_ALIAS
    | ALIAS_NAME : Shorthand Alias Name
    |
    +-KFF_CVR_RULE
    | FLEX_VALIDATION_RULE_NAME : Cross Val. Rule Name.
    |
    +-KFF_SEGMENT
    SEGMENT_NAME : Segment Name
    APPLICATION_COLUMN_NAME : Column Name
    MENU
    You can find the following parameters in Set Filter screen of Menus.
    PARENT_MENU_NAME Name of the menu to start downloading at. If this
    parameter is specified on its own, that menu and
    all its children will be downloaded. If specified
    with FUNCTION_NAME and/or SUB_MENU_NAME, then only
    the menu entry with that function and/or submenu name
    immediately under the PARENT_MENU_NAME will be
    downloaded.
    FUNCTION_NAME Function name to limit download to. If this parameter
    is specified then PARENT_MENU_NAME must also be
    specified in order to download menus. Specifies
    the function on a menu entry immediately under
    PARENT_MENU_NAME which will be downloaded; all other
    menu entries under PARENT_MENU_NAME will not be
    downloaded.
    SUB_MENU_NAME Sub Menu name to limit download to. If this parameter
    is specified then PARENT_MENU_NAME must also be
    specified in order to download menus. Specifies
    the Sub Menu on a menu entry immediately under
    PARENT_MENU_NAME which will be downloaded (along with
    all its children); all other menu entries under
    PARENT_MENU_NAME will not be downloaded.
    MENU_APP_SHORT_NAME Application short name of Menu. The menu on the resp
    for this application will be downloaded. If you
    pass this parameter, do not pass any of the other
    parameters; this parameter is only supported on its
    own.

    Oh never mind.... I figured it out myself helps to read up on the manuals. d'oh. sorry for the bandwidth waste...

  • Run time error when set filter on the request id in the output query.

    Hi all,
    I am getting a run time error when I select the request id and set filter on that and  when i am selecting all the request id it contains around 2lacs values in that If i cliked ok on that .
    It popped up a msg like this
    " Run time error 61706
    Insufficient memory to perform operation "

    User was educated not to select the entire data in the filter

  • How to disable 'set filter' in alv list display

    Hi Friends,
    I am working on alv report and I came across a requirement that I need to disable the 'set filter' to restrict the user from filtering records in output.
    please help on this.
    thanks in advance.

    HI
    check these sample codes
    Here are some code snippets:
    FORM output_report.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = 'ZRRRMPROJSTAT'
    is_layout = gs_layout
    it_fieldcat = gt_fieldcat
    it_sort = gt_sort
    i_save = 'A'
    it_events = gt_events
    TABLES
    t_outtab = i_project
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    ENDFORM. " output_report
    FORM build_fieldcat.
    DATA: s_fieldcat TYPE slis_fieldcat_alv.
    DATA: l_col_count like s_fieldcat-col_pos.
    l_col_count = 1.
    CLEAR s_fieldcat.
    s_fieldcat-col_pos = l_col_count.
    l_col_count = l_col_count + 1.
    s_fieldcat-tabname = i_project.
    s_fieldcat-fieldname = 'PSPID'.
    s_fieldcat-datatype = 'CHAR'.
    s_fieldcat-outputlen = '10'.
    s_fieldcat-seltext_l = 'Project Number'.
    s_fieldcat-seltext_m = 'Project Number'.
    s_fieldcat-seltext_s = 'Project Number'.
    s_fieldcat-key = 'X'.
    s_fieldcat-fix_column = 'X'.
    s_fieldcat-just = 'C'.
    s_fieldcat-no_zero = 'X'.
    APPEND s_fieldcat TO gt_fieldcat.
    * and so on....
    ENDFORM
    FORM sort_layout.
    DATA: ls_sort TYPE slis_sortinfo_alv.
    REFRESH gt_sort.
    CLEAR ls_sort.
    ls_sort-spos = '1'.
    ls_sort-tabname = 'i_project'.
    ls_sort-fieldname = 'PSPID'.
    APPEND ls_sort TO gt_sort.
    CLEAR ls_sort.
    ls_sort-spos = '2'.
    ls_sort-tabname = 'i_project'.
    ls_sort-fieldname = 'POSID'.
    APPEND ls_sort TO gt_sort.
    ENDFORM. " sort_layout
    FORM build_layout.
    CLEAR gs_layout.
    * gs_layout-totals_before_items = 'X'.
    gs_layout-zebra = 'X'.
    gs_layout-numc_sum = 'X'.
    gs_layout-get_selinfos = 'X'.
    gs_layout-box_tabname = 'X'.
    gs_layout-info_fieldname = 'COLOR'.
    ENDFORM. "
    Reward alll helpfull answers
    Regards
    Pavan

  • Problem in ALV set filter option

    Hi to all
    I have an issue regarding ALV report :
    I have developed an ALV report and it is showing report output correctly as required.
    when I further filter it on a particular field using SET FILTER OPTION , the length of the field is shorter than displayed.
    Why this happens so.
    BUT for the same field in a standard ALV report , it shows the same length as displayed in report.
    Please advice. As this is the standard ALV functionality.
    Thanks & Regards
    Anubhav gupta

    Hi Gupta,
    <li>Define layout structure
    data: wa_layout   TYPE slis_layout_alv.
    <li>Pass value like below
      wa_layout-colwidth_optimize = 'X'.
    <li>Pass this structure through fm
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
             EXPORTING
                  i_callback_program = program
                  it_fieldcat        = it_fieldcat
                  is_layout          = wa_layout
                  it_events          = it_events
             TABLES
                  t_outtab           = i_mard.
    Thanks
    Venkat.O

  • Display medium text in a 'set filter' box

    I have a hierarchy and populated all levels of text(small, medium, and long).  We want to display the medium text when reporting.  I have made all the required changes to display the medium text of the hierarchy for reporting.  That works great!  However, when you hit the 'set filter value', the filter box shows the hierarchy with the small text.  Is there a way to change the text display for the filter box?
    Thanks,
    Matt

    Take a look at the following thread:
    F4 help - Search values - I need key and text
    Hope this helps...
    Bob

  • ALV Question : How to set filter condition which contain dummy character?

    Hi,
    I want to set filter condition of ALV dynamicly (In my code),
    for example, set 'X' as filter condition in column "Description",
    I add the code successfully, but I can't get the correct filtered result, Why?

    Please post ur code here.
    U have to get a  handle to the IF_SALV_WD_FILTER interface
    data ref_filter   type ref to IF_SALV_WD_FILTER  .
    ref_filter ?= m_config_model->IF_SALV_WD_FIELD_SETTINGS~GET_FIELD( 'FIELD DESCRIPTION' )
    ref_filter->CREATE_FILTER_RULE( 
                       low_val = 'X'
    Now when u load the ALV tabl;e u should see a X value in the filter row, for the column 'FIELD DESCRIPTION'  and the filter should happen.
    As I said, pls paste ur code here.

  • Automatic Set up of Google Alerts in Siebel

    Hi
    How can we Set-up of Google Alerts to Provide Updated Information(Public Domain Info) in Siebel
    Is there any possibility to do this?
    If so, Plz Need info Regarding this
    Thanks & Regards
    Prasad

    the fast/automatic recovery (fast master catchup) is only possible when (a) you are using 2-safe replication (which you are) and (b) log fail threshold has not been triggered (by the way a value of '1' for this is extremely low!).
    If either of conditions (a) or (b) are not met then you have to recover via a 'duplicate'.
    Chris

  • How do i set a data usage alert

    How do I set a data usage alert?

    This isn't a feature that's built into iOS.
    Most carriers will send an alert before you reach your data cap and you can check your data usage in Settings > Usage > Cellular Usage.

  • Is there a way to set different volumes for Alerts, phone ringing

    I would like to be able to set different volumes for Alerts, Phone ringing, and incomming mail.  Is this possible?

    No, not at this time. The alerts and phone ringing are all the same. You can provide feedback to Apple if you would like to let them know you would like to see this feature implemented by going to http://www.apple.com/feedback/iphone.html

  • BI Application Frame - set filter values

    Hi,
    I have a BI application frame in my WebDynpro ABAP component and I want to set filter values. The variables are already defined in the BEx query so I only want to pass the values of the variables.
    Does anybody have an idea how to do this?
    Regards,
    Steffen

    Any help...

  • How to set automatic e-mail alert for 90% threshold reach for MAXDBdatabase

    Hi,
    I want to set automate e-mail alert for 90% threshold reach for MAXDB database i.e. data area. I want to know where i can set the automate e-mail alert for data area in MAXDB database? As i have already have script for oracle tablespace alert if tablespace reaches 90% it sends me an auotmated e-mail.
    Please let me know where to do the settings or any script available for MAXDB database data area automate e-mail alert....
    Thanks,
    Narendra

    Hello,
    What is the version of your database?
    Are you SAP customer?
    Please see the MAXDB documentation,
    Review the Standard Events at:
    http://maxdb.sap.com/doc/7_7/default.htm
    -> Glossary -> Event
    And u201CMonitoring Free Memory in the Data Areau201D section at:
    http://maxdb.sap.com/doc/7_7/default.htm
    -> Database Administration
    -> Monitoring Databases
    see example at:
    http://maxdb.sap.com/doc/7_7/default.htm
    -> Tutorials ->Database Manager CLI Tutorial
    -> Using the Event Dispatcher Function
    -> Event-Controlled Sending of E-mails
    Thank you and best regards, Natalia Khlopina

  • Setting monitoring and SLA Alerts via Workspace studio

    Hi,
    Is it possible to set monitoring and SLA Alert rules via workspace studio. If yes, could you please help me how to do it.
    Thanks
    James

    Hi..
    Operational settings such as enabled, tracing, monitoring etc are easily set within eclipse by editing with the text editor rather than the proxy editor..
    The SLA Alerts are possible to modify in the same way, but they're a bit more tricky to figure out..
    ..Mark.

  • Pre-setting filter value

    Hi,
    I have a page wich has a tabstrip with 2 tabs.
    On tab 1 all keyvalues are displayed in a table view, on tab 2 all details for all keyvalues are also displayed in a table view but with a filterfunction.
    When i select a keyvalue on tab1 and navigate to tab2 is want to set the filtervalue of the tableview prior for displaying.
    I'm using the cl_htmlb_manager=>set_filter_row_value when selecting a keyvalue during the DO_HANDLE_EVENT in the ControllerClass.
    But when i navigate to tab2 no filtering is done, the id is correctly filled.
      CASE event.
        WHEN 'id_tabstrip'.
    *     Keuze tabstrip met artikelen
          IF     lrf_model->h_active_tab = 'id_keyvalue'.
    *       User switches to detail tab
    *       Set filter TableView Details
            lh_filter_value = lrf_model->selected_key_value.
            CALL METHOD cl_htmlb_manager=>set_filter_row_value
              EXPORTING
              request           = request
              id                   = 'id_tv_detail'
              column_index = '1'
              value              = lh_filter_value.
    Can it work?

    Hi,
    Is there a possibillity to pre-setting a filter value.
    I cannot filter the table manually and the switch to the next tab because then the filter functionality won't work.
    Hope to hear from you..

  • FileDialog, how to set filter?

    i try to use
    setFilenameFilter(FilenameFilter filter)
    to set filter for FileDialog, but FilenameFilter is an interface, what is the story?
    do u know how to set filter?
    thanks in advance

    Construct a FileFilter class like:
    public class CustomFilter implements FileFilter{
         public CustomFilter(){
    public String getFileExtension(File file) {
    String ext = null;
    String s = file.getName();
    int i = s.lastIndexOf(".") + 1;
    ext = s.substring(i).toLowerCase();
    return ext;
    public String doSomething(){
    //do Something
    //return something
    and use the setFileFilter(FileFilter filter) method.

Maybe you are looking for

  • Is it feasible to do System copy between SAP r/3 4.7 and ECC 6.0?

    Hello Everyone, Please let me know is it possible to do a system copy between two different SAP versions( SAP R/3 and ECC6.0 ABAP stack) Background: OS: Windows 2003 DB: MSSQL 2005 Appreciate your response Thanks, Vadivambal

  • IOS 5.1 AAC encoded music with "High Efficiency" is not playing

    Hello to all, Since I upgraded my iPhone 4 to iOS 5.1, m4a tracks encoded in AAC with "High Efficiency" profile are NOT playing. The tracks are playing correctly in iTunes on my MacBook Pro but they are not playing on the iPhone. This is a serious an

  • Almost every CC installation ended with errors :/

    Mostly revolving around 2 fonts: CharlemagneStd-Bold.otf MinionPro-Bold.otf It says everything installed but there was a yellow yield sign next to each one afterward (with the error detail), so I don't know if everything is ok or if I will have probl

  • How to create an idoc thru custom pgm

    i have some data in 1 sap system. this shud b colected n send to another system thru idocs. can any one give me sample code 4 it? tx kiran

  • How to read XML file kept on NON-SAP server using the Http URL ?

    Dear Experts, I am working on CRM2007 web UI. I need to read a XML file placed on a shared server location by a third party program. Then process that XML file into CRM and create a quotation using the data extracted from the file. All i have with me